webpack.js.org icon indicating copy to clipboard operation
webpack.js.org copied to clipboard

webpackMode: "eager" magic comment can generate extra chunks

Open EmpireJones opened this issue 4 years ago • 3 comments

From the documentation of the webpackMode "eager" on https://webpack.js.org/api/module-methods/#magic-comments, it states:

Generates no extra chunk. All modules are included in the current chunk and no additional network requests are made. A Promise is still returned but is already resolved. In contrast to a static import, the module isn't executed until the call to import() is made.

From what I can tell, this doesn't really describe the full behavior. If I use it in combination with the webpackChunkName magic comment, I'm able to eagerly load via a new chunk / separate network request (which is useful for me, as it results in it getting added to the list of chunks output by the webpack-flush-chunks package).

EmpireJones avatar Dec 27 '19 19:12 EmpireJones