Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: export types and commonjs bundle #821

Merged
merged 1 commit into from
Dec 31, 2021
Merged

fix: export types and commonjs bundle #821

merged 1 commit into from
Dec 31, 2021

Conversation

ph-fritsche
Copy link
Member

What:

Add export as bundled CommonJS.

Fix types export.

Why:

Closes #813
Closes #819

How:

Bundle files in dist/index.cjs as CommonJS module.
Bundle files in dist/index.mjs as EcmaScript module.
Export types to dist/types.

Point main to CJS export.
Point module to ESM export.
Let exports resolve any import per require to CJS otherwise ESM.
Point types to dist/types/index.d.ts.

Checklist:

  • Ready to be merged

@ph-fritsche ph-fritsche added this to the userEvent v14 milestone Dec 31, 2021
@codesandbox-ci
Copy link

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

Latest deployment of this branch, based on commit 6ec470d:

Sandbox Source
userEvent-PR-template Configuration

@codecov
Copy link

codecov bot commented Dec 31, 2021

Codecov Report

Merging #821 (6ec470d) into beta (1a5e2a7) will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff            @@
##              beta      #821   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           79        79           
  Lines         1578      1578           
  Branches       559       559           
=========================================
  Hits          1578      1578           

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 1a5e2a7...6ec470d. Read the comment docs.

@ph-fritsche ph-fritsche merged commit 4f56856 into beta Dec 31, 2021
@ph-fritsche ph-fritsche deleted the build branch December 31, 2021 17:35
@github-actions
Copy link

🎉 This PR is included in version 14.0.0-beta.5 🎉

The release is available on:

Your semantic-release bot 📦🚀

@ph-fritsche ph-fritsche linked an issue Dec 31, 2021 that may be closed by this pull request
@briandipalma
Copy link

I think this breaks the library in Webpack 4 unless you add:

  webpackConfig.module.rules.push({
    test: /\.mjs$/,
    include: /node_modules/,
    type: "javascript/auto",
  });

to your configuration. Probably worth adding in release notes/blog.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

index.d.ts is not a module Nested default exports with using dynamic import
2 participants