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

Convert JavaScript to native ES Modules #22

Closed
JohnAlbin opened this issue Dec 22, 2021 · 2 comments
Closed

Convert JavaScript to native ES Modules #22

JohnAlbin opened this issue Dec 22, 2021 · 2 comments
Labels
feature New feature or request
Milestone

Comments

@JohnAlbin
Copy link
Owner

JohnAlbin commented Dec 22, 2021

We are currently distributing this packages as CommonJS files (compiled by Babel). Since we dropped support for Node.js v12 in #20, Node.js v14 and later support native ES Modules and we don't need to distribute CommonJS or use Babel.

  • Update package.json to add a "type": "module".
  • Convert import statements from file-extension-less references (supported by Node.js' CommonJS conventions) to fully-specified filename references supported by ES Modules.
  • Remove Babel.
  • Update our main entry to point at lib/index.js.
  • Add exports in our package.json to remove the lib part of the path.

Follow-ups:

@JohnAlbin JohnAlbin added the feature New feature or request label Dec 22, 2021
@JohnAlbin JohnAlbin added this to the 1.0 milestone Dec 22, 2021
@JohnAlbin
Copy link
Owner Author

JohnAlbin commented Dec 31, 2021

Copying comment from another issue:

One reason to reconsider is that this change breaks Storybook support.

(Just discovered this when I tried to upgrade from 1.0.0-alpha.6 to your new beta.)

(I should add that I'm using Node 16 and the latest version of Storybook with its Webpack 5 option enabled.)

The commenter doesn't say which beta they were using. Beta 1 and beta 2 definitely didn't work with Webpack 4, but beta 3 does.

Re-opening until we confirm this works with Webpack 5.

@JohnAlbin
Copy link
Owner Author

Fixing with #46

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

No branches or pull requests

1 participant