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

ESM build #64

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

ESM build #64

wants to merge 2 commits into from

Conversation

edemaine
Copy link

@edemaine edemaine commented Jul 21, 2023

Replace old dist/es/index.js with dist/index.mjs that uses ESM syntax, and properly link to it via module and exports.

Fixes #63

I also updated Webpack because otherwise I couldn't get it to run on modern Node.

What kind of change does this PR introduce?

  • Bug Fix
  • Feature
  • Refactoring
  • Style
  • Build
  • Chore
  • Documentation
  • CI

Did you add tests for your changes?

  • Yes, my code is well tested
  • Not relevant

If relevant, did you update the documentation?

  • Yes, I've updated the documentation
  • Not relevant

Summary
See #63. This lets you import accept from 'attr-accept' in ESM code.

Does this PR introduce a breaking change?
If anyone directly imported dist/es/index.js, it no longer exists. (It seems to be a holdover that made a "fake" ES module.)

Other information
You can test the example in the README by making a file test.mjs and then running node test.mjs. (The .mjs extension forces ESM mode.)

Replace old `dist/es/index.js` with `dist/index.mjs` that uses ESM
syntax, and properly link to it via `module` and `exports`.

Fixes react-dropzone#63
"module": "dist/es/index.js",
"module": "src/index.js",
"exports": {
"import": "./dist/index.mjs",

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You should provide types in the export map: https://publint.dev/rules#types_not_exported

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

Successfully merging this pull request may close these issues.

ESM build?
2 participants