Build fails in CRA 5.0.0 (Webpack 5), due to ESM strict mode - "Module not found: Error: Can't resolve '../data-grid/data-grid-types'"
See original GitHub issueI’m trying to use glide-data-grid in fresh application, bootstrapped by creat-react-app@5.0.0
, but it fails to build it:
It seems to be caused by ESM strict mode which is enabled by webpack 5 (since v5.0.0-beta.30 release) which requires extensions in esm imports
Possible solution
https://www.npmjs.com/package/typescript-esm might help here
Reproduction example:
- https://github.com/ewgenius/cra-5-glide-data-grid-example - bare CRA@5 app with Typescript template
- failed build example https://github.com/ewgenius/cra-5-glide-data-grid-example/runs/5681360680?check_suite_focus=true
Issue Analytics
- State:
- Created a year ago
- Comments:7 (5 by maintainers)
Top Results From Across the Web
Webpack5 ESM strict mode · Issue #12058 · babel ... - GitHub
Bug Report Webpack5 beta.30 has enabled strict mode on the ESM modules ... webpack 5.0.0-beta.30 Module not found: Error: Can't resolve '.
Read more >i tried to Polyfill modules in webpack 5 but not working (Reactjs)
I resolve these errors but my app did not render. ... To use polyfill in webpack 5 in reactjs Follow the below steps:....
Read more >Setting up a React app from scratch withWebpack, Babel and ...
The core function of Webpack is that it takes a bunch of JavaScript files we write in our project and turns them into...
Read more >react-app-rewired - npm
When running in development mode, create-react-app does not use the usual Webpack config for the Development Server (the one that serves the app ......
Read more >webpack < 5 used to include polyfills for node.js core modules ...
Failed to compile. Module not found: Error: Can't resolve 'stream' in ... node_modules/react-moralis/lib/index.esm.js 3:0-36 5307:11-24 @ .
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Fixed in 4.0.0
Thank you, I will look into typescript-esm. Very annoying that they turned on strict mode in CRA 5, not sure I really see the benefit.