Cannot read property '__esModule' of undefined
See original GitHub issueBug report
What is the current behavior? We have a components library where we have multiple entry points setup for components. Since we had nesting of components as well, we were ending up duplicating the code.
Hence we used the optimization block inside the config.
optimization: {
splitChunks: {
chunks: 'all',
minChunks: 1,
minSize: 1000,
maxInitialRequests: Infinity,
cacheGroups: {
vendorCss: {
test: /[\\/]node_modules[\\/](@hotstar\/isomorphic-style-loader|css-loader)[\\/]/,
name: 'vendor_css_loaders',
chunks: 'all',
},
}
},
But after using this to bundle our components lib, and using this library inside the next.js app we get the error
TypeError: Cannot read property '__esModule' of undefined
at /Users/ajayjaggi/Desktop/Hotstar/web-website/node_modules/@hotstar/web-ui-components-lib/modern/components/Molecule/CustomError/src/index.js:328:34
at Object.<anonymous> (/Users/ajayjaggi/Desktop/Hotstar/web-website/node_modules/@hotstar/web-ui-components-lib/modern/components/Molecule/CustomError/src/index.js:330:12)
at Module._compile (internal/modules/cjs/loader.js:1085:14)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1114:10)
at Module.load (internal/modules/cjs/loader.js:950:32)
at Function.Module._load (internal/modules/cjs/loader.js:790:12)
at Module.require (internal/modules/cjs/loader.js:974:19)
at require (internal/modules/cjs/helpers.js:93:18)
at Object.@hotstar/web-ui-components-lib/modern/components/Molecule/CustomError/src (/Users/ajayjaggi/Desktop/Hotstar/web-website/packages/website/.next/server/pages/_app.js:1273:18)
at __webpack_require__ (/Users/ajayjaggi/Desktop/Hotstar/web-website/packages/website/.next/server/webpack-runtime.js:33:42)
which arises from here at 192 line.

If the current behavior is a bug, please provide the steps to reproduce. Mentioned above
What is the expected behavior? It should run without giving any errors
Other relevant information: webpack version: 5.40 Node.js version: 14.0.0 Operating System: mac os next.js version: 12.0.7
Issue Analytics
- State:
- Created a year ago
- Comments:5 (3 by maintainers)
Top Results From Across the Web
TypeError: Cannot read property '__esModule' of undefined ...
Got an answer from webpack. It's a bug in webpack. PR to fix (not yet accepted, but works as patch).
Read more >Cannot read property '__esModule' of undefined-Vue.js
Coding example for the question Dynamic Component gives TypeError: Cannot read property '__esModule' of undefined-Vue.js.
Read more >Liferay.Loader.define of undefined - Forums
Uncaught TypeError : Cannot read property 'define' of undefined ... defineProperty(exports, "__esModule", { value: true }); exports.default = function (msg) ...
Read more >Vue-hot-reload-api Cannot read property '__esModule' of ...
js:15 Uncaught TypeError: Cannot read property '__esModule' of undefined at Object../node_modules/vue-hot-reload-api/dist/index.js.exports.
Read more >Gotchas - Remix
It almost always means that server code made it into browser bundles. TypeError: Cannot read properties of undefined (reading 'root'). For example, you...
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 Free
Top 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

please create small reproducible repo, thanks
This issue had no activity for at least three months.
It’s subject to automatic issue closing if there is no activity in the next 15 days.