moduleraid breaks when used in a Webpack v5 bundle
See original GitHub issueWhat the title says 😅
For some reaosn the result of require('moduleraid')
in an app bundled with Webpack v5 is an empty object.
See a repro in this repo https://github.com/eramdam/moduleraid-webpack5-repro
Issue Analytics
- State:
- Created 3 years ago
- Comments:5 (3 by maintainers)
Top Results From Across the Web
Dynamic require breaks when using more than one webpack ...
I've run into this issue several times, and it seems the reason behind it lies in conflict between multiple webpack bundles.
Read more >Code Splitting - webpack
This feature allows you to split your code into various bundles which can then be loaded on demand or in parallel. It can...
Read more >Webpack 5 release (2020-10-10)
webpack is a module bundler. Its main purpose is to bundle JavaScript files for usage in a browser, yet it is also capable...
Read more >To v5 from v4 - webpack
This guide aims to help you migrating to webpack 5 when using webpack directly. If you are using a higher level tool to...
Read more >Tree Shaking - webpack
Tree shaking is a term commonly used in the JavaScript context for dead-code elimination. It relies on the static structure of ES2015 module...
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
@tomer8007 Hum, it seems like @pedroslopez’s fix allows moduleraid to inspect a webpack v5 bundle. My issue happens when bundling moduleraid in a webpack v5 bundle 😅
@ScriptedAlchemy the issue isn’t that moduleraid can’t access Webpack v5’s package at runtime, which I would expect, but rather than using moduleraid in a Webpack 5 bundle results in the imported moduleraid code to not work/be an empty object 😅
EDIT: Weirdly enough, importing the source file directly into the codebase works fine, so I guess whatever is wrong lies in the dist file present in the npm package