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.

Odd output with webpack-dev-server

See original GitHub issue

While I’m sure that building a .js entry point with webpack-dev-server is probably an odd use case (testing in an external .html that pulls in the built library), I figured I’d report the bug I came across anyway.

I have a code bundle that just has a single default export. When building normally with webpack, I get the expected output:

export default LIB['default'];

But when building with webpack-dev-server (no configuration changes), I get an unexpected output:

export default LIB;
export { LIB };

export default LIB;
export { LIB };

export default LIB['default'];

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:4
  • Comments:10 (6 by maintainers)

github_iconTop GitHub Comments

2reactions
andrewstartcommented, Aug 13, 2020

It seems to work fine for me, the dev server runs fine and the normal build continues to build correctly. I did have to correct your skipModule function though:

skipModule(fileName, module) {
    return /[\\\/]webpack(-dev-server)?[\\\/]/.test(fileName);
}
1reaction
riovircommented, Aug 1, 2020

Here you go: https://github.com/riovir/esm-webpack-plugin-i15-reprod

I’ve added some extra hoops, such as code splitting the bundled library to indicate it would still work if that pesky webpack-generated, extra HMR module wouldn’t topple the plugin over.

If the codebase is too bulky, don’t hesitate to ask for a simpler one!

Read more comments on GitHub >

github_iconTop Results From Across the Web

webpack output is served from undefined · Issue #2745 - GitHub
Describe the bug The output of webpack doesn't get served. What is the current behavior? My config: const path = require('path'); ...
Read more >
Webpack devServer no output files generated? - Stack Overflow
Question - Answer: So it seems like the dist folder is generated elsewhere? [...] Yes. From one GitHub thread:.
Read more >
Build Performance - webpack
This guide contains some useful tips for improving build/compilation performance. General. The following best practices should help, whether you're running ...
Read more >
Introduction to webpack: Entry, Output, Loaders, and Plugins
At first, it might look strange to see a `.js` file require a stylesheet, ... npm install webpack webpack-dev-server --save-dev.
Read more >
The webpack plugin I can't live without - rossta.net
It parses the "stats" output of a webpack build and constructs an interactive Voronoi treemap using the FoamTree library. It might look a...
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