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 importing rdg with webpack 4 #2221

Merged
merged 4 commits into from Nov 10, 2020
Merged

Fix importing rdg with webpack 4 #2221

merged 4 commits into from Nov 10, 2020

Conversation

nstepien
Copy link
Contributor

@nstepien nstepien commented Nov 10, 2020

  • webpack 4 doesn't treat .mjs files as esm by defeault for some reason, so we have to publish the esm bundle as .js
  • In node, importing react-data-grid from an esm only works if its file extension is .mjs, or .js when "type": "module" is in the package.json
  • Now that we use "type": "module", modules that are imported from commonjs modules must have the .cjs file extension, as cjs cannot import esm in Node.
    • this is why eslint and storybook had to be fixed.
    • all .js files are treated as esm now by Node.
  • Importing esm rdg in Node will not work because Node cannot find the react/jsx-runtime import without a file extension, but that could be fixed with react adding the exports field.

@nstepien nstepien self-assigned this Nov 10, 2020
@nstepien nstepien marked this pull request as ready for review November 10, 2020 11:06
@nstepien nstepien merged commit d8b128a into canary Nov 10, 2020
@nstepien nstepien deleted the mjs branch November 10, 2020 14:23
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.

None yet

2 participants