question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

support webpack5 new library type 'module'

See original GitHub issue

Issue 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:open
  • Created 2 years ago
  • Reactions:5
  • Comments:8 (2 by maintainers)

github_iconTop GitHub Comments

0reactions
valscioncommented, Dec 22, 2022

Anyone who wants to can take a stab at fixing this with a PR ☺️

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found