support webpack5 new library type 'module'
See original GitHub issueIssue description
Currently, It cannot parse properly when webpack5 config library type to module
. Because webpack5 append some codes like export {a, b, c}
to the end of the bundle.
const config: webpack.Configuration = {
output: {
libraryTarget: 'module',
},
experiments: {
outputModule: true,
},
plugins: [new BundleAnalyzerPlugin({ analyzerMode: 'static' })],
}
Technical info
System: OS: macOS 11.2.3 CPU: (4) x64 Intel(R) Core(TM) i5-7500 CPU @ 3.40GHz Memory: 3.01 GB / 24.00 GB Shell: 5.8 - /bin/zsh Binaries: Node: 15.11.0 - /usr/local/bin/node Yarn: 1.22.10 - /usr/local/bin/yarn npm: 7.6.0 - /usr/local/bin/npm Watchman: 4.9.0 - /usr/local/bin/watchman npmPackages: case-sensitive-paths-webpack-plugin: 2.4.0 => 2.4.0 fork-ts-checker-webpack-plugin: 6.2.0 => 6.2.0 webpack: 5.28.0 => 5.28.0 webpack-bundle-analyzer: 4.4.0 => 4.4.0 webpack-cli: 4.5.0 => 4.5.0 webpack-merge: 5.7.3 => 5.7.3
Debug info
How do you use this module? As CLI utility or as plugin?
plugin
If CLI, what command was used? (e.g. webpack-bundle-analyzer -O path/to/stats.json
)
If plugin, what options were provided? (e.g. new BundleAnalyzerPlugin({ analyzerMode: 'disabled', generateStatsFile: true })
)
new BundleAnalyzerPlugin({ analyzerMode: 'static' })
What other Webpack plugins were used?
Issue Analytics
- State:
- Created 2 years ago
- Reactions:5
- Comments:8 (2 by maintainers)
Top Results From Across the Web
Authoring Libraries | webpack
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 >Use Webpack 5 to build an ES module bundle, and consume ...
Since you use type: "module" , Node.js will treat this module as ESM. ... If you're using webpack to compile a library to...
Read more >How to Build a Micro Frontend with Webpack's Module ...
Expose any code from any application that Webpack supports. ... Type is the type of library that can be a variable, module, etc....
Read more >Webpack - npm
Packs CommonJs/AMD modules for the browser. Allows to split your codebase into multiple bundles, which can be loaded on demand. Support ...
Read more >JavaScript modules - MDN Web Docs
... a number of JavaScript libraries and frameworks that enable module ... browsers have started to support module functionality natively, ...
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
Turn
https://github.com/webpack-contrib/webpack-bundle-analyzer/blob/d96ebed7d0dd38e6a0b9a935aaac0d3c24722944/src/parseUtils.js#L13
To
will work
Anyone who wants to can take a stab at fixing this with a PR ☺️