-
-
Notifications
You must be signed in to change notification settings - Fork 9.1k
Closed
Description
When splitting code in webpack, the chunks are loaded with temporary script tags:
/******/ var head = document.getElementsByTagName('head')[0];
/******/ var script = document.createElement('script');
/******/ script.type = 'text/javascript';
/******/ script.charset = 'utf-8';
/******/ script.async = true;
/******/ script.timeout = 120000;
/******/ script.src = __webpack_require__.p + "" + ({}[chunkId]||chunkId) + "." + "<some_key>" + ".js";
When creating an umd library, the library might be loaded by another bundler again (webpack, jspm, etc.). In that case, the script tag loading isn't nice. It would be better to keep the AMD (or System.import for webpack 2) in the chunks which will be interpreted by the other bundler. I didn't find an option to enable this. Is it a missing feature? Or am I missing something and code splitting in umd libraries not possible?
AndyOGo, LucaMele, raphaelsantos-hotmart, u3u, btoo and 1 more
Metadata
Metadata
Assignees
Type
Projects
Milestone
Relationships
Development
Select code repository
Activity
sokra commentedon May 11, 2016
It's a missing feature..
davidagraf commentedon May 12, 2016
This feature would be super handy for us. What's the difficulty in implementing it? I guess, replacing the temp script stuff with System.import is not complicated, right? Is the problem the current jsonp in the bundles?
sokra commentedon May 12, 2016
It all starts here: https://github.com/webpack/webpack/blob/master/lib/JsonpTemplatePlugin.js
This is the important part: https://github.com/webpack/webpack/blob/master/lib/JsonpMainTemplatePlugin.js
You need to write a custom target too: https://github.com/webpack/webpack/blob/master/lib/WebpackOptionsApply.js#L68-L77
You can publish all off this as separate module like here:
https://github.com/chentsulin/webpack-target-electron-renderer#how-this-module-works
webpack-bot commentedon Jan 3, 2018
This issue had no activity for at least half a year.
It's subject to automatic issue closing if there is no activity in the next 15 days.
webpack-bot commentedon Jan 19, 2018
Issue was closed because of inactivity.
If you think this is still a valid issue, please file a new issue with additional information.
11 remaining items