-
Notifications
You must be signed in to change notification settings - Fork 46
Allow google closure self-managed js dynamic importsΒ #72
Description
Google Closure Library has a dynamic imports engine --- goog.module.ModuleManager, which can be used to lazy loading JS resource. This engine is different from webpack, thus it should be handled without webpackJsonp.
I have used ModuleManager successfully to realize JS lay loading with closure-webpack-plugin, only in case where entry chunks have no common dependence.
I have to use CommonChunksPlugin When entry chunks have common dependence, as mentioned in Readme. But webpack tries to handle child chunk(lazy loading chunk) with webpackJsonp, which will cause child chunk lazy loading failure. The reason is below:
closure-webpack-plugin/src/index.js
Lines 440 to 446 in 2786b26
| if (parentChunk !== null) { | |
| return `${defParts[0]}:webpackJsonp([${ | |
| chunk.id | |
| }], function(__wpcc){%s});`; | |
| } else if (chunk) { | |
| return `${defParts[0]}:${entryChunkWrapper}`; | |
| } |
I suggest adding an option: entryChunks to use entryChunkWrapper instead of webpackJsonp.
Could you grant me pull request permission? I have done implemented it locally. @ChadKillingsworth