-
-
Notifications
You must be signed in to change notification settings - Fork 9.4k
Description
Bug report
While integrating TypeScript 3.9 I noticed significant bundle size regressions and confirmed it was triggered by the export * is always retained change by using TS nightlies.
I've created a more minimal repro showing that exporting an empty module with no executable code with contents such the one below has significant impact on bundle output.
//# sourceMappingURL=DockPanel.Props.js.map
What is the current behavior?
Adding exports to modules that contain no executable code cause a significant change in bundle output. These images show the effects of adding an export of an empty module with the contents shown above (shown on the left in the images) on bundle output (shown on the right):
Webpack 4:
Webpack 5:
This also has dramatic effects on split chunk behavior, causing wide swaths of code to move between chunks. I'm hoping this minimal repro is the cause of that behavior, but I'm not sure how to confirm that hypothesis at this point.
If the current behavior is a bug, please provide the steps to reproduce.
Repros
- Branch based off
webpack-4 - Branch based off
webpack-5 - webpack4-repro patch file
- webpack5-repro patch file
All of these contain a new example called side-effects-empty-module which can be run using the standard example steps. The key line is in module-with-export/index.js which shows dramatic changes to bundle output when commented in and out (effects shown above.)
What is the expected behavior?
I've been chatting with @TheLarkInn about this for the past couple of days and agreed we should enter this issue. I don't think empty module exports should affect the bundle output. (Or at least I would like to understand the reason and mitigate the behavior.)
Other relevant information:
webpack version: 4.43.0, 5.0.0-beta.16
Node.js version: 12.16.3
Operating System: Windows 10
Additional tools:
Terms: bundle size regression, ts3.9, typescript 3.9, 3.9.2

