Remove webpack bootstrap for single-module apps
See original GitHub issueThere’s a couple of entry points within my application which either a) don’t rely on any other modules or b) only rely on external modules.
I’d ideally like to remove the ‘webpack bootstrap’ for these entry points, since AFAIK it doesn’t add any value, but does add marginal runtime overhead.
I made the following change to MainTemplate
which seems to work. It omits the module boilerplate when there’s only a single module, but is quite hacky (mostly around the coupling to require
):
https://github.com/webpack/webpack/compare/master...ljwagerfield:single-module-template
Are there any better ways of disabling the ‘module loading’ boilerplate?
Issue Analytics
- State:
- Created 7 years ago
- Reactions:70
- Comments:33 (2 by maintainers)
Top Results From Across the Web
Remove Webpack bootstrap from output file - Stack Overflow
After some research, I couldn't find a proper way to do this. But investigating for an alternative I could find rollupjs , an...
Read more >Webpack - Bootstrap
Learn how to include Bootstrap in your project using Webpack 3. Installing Bootstrap. Install bootstrap as a Node.js module using npm. Importing JavaScript....
Read more >Entry Points - webpack
Multi-page applications that reuse a lot of code/modules between entry points can greatly benefit from these techniques, as the number of entry points...
Read more >Output Management - 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 >Module Federation - webpack
Multiple separate builds should form a single application. These separate builds act like containers and can expose and consume code between builds, ...
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
We considering it
webpack 5 alpha 31 supports this.
Here is an example: https://github.com/webpack/webpack/tree/f25906fd2fd0bbcf472d9d44dcd8d6a92e3fbe95/examples/module
The following conditions must be met:
output.module: true
(otherwise it would be wrapped in an IIFE)