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.

Remove webpack bootstrap for single-module apps

See original GitHub issue

There’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:closed
  • Created 7 years ago
  • Reactions:70
  • Comments:33 (2 by maintainers)

github_iconTop GitHub Comments

25reactions
sokracommented, Sep 17, 2018

We considering it

19reactions
sokracommented, Oct 10, 2019

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:

  • single EcmaScript module, or all modules concatenated
  • no other runtime helper needed
  • output.module: true (otherwise it would be wrapped in an IIFE)
Read more comments on GitHub >

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

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