webpack: chunks broken in IE
I am trying to conditionally load a polyfill like this:
if (utils.needsHistoryPolyfill()) {
require.ensure(['html5-history-api'], function(require) {
require('html5-history-api');
openApp();
});
}
else {
openApp();
}
If I do a hard-refresh, everything works. But on subsequent soft-refreshes (where the script jsonp response is loaded from cache in IE9), the chunk’s code is never executed.
About this issue
- Original URL
- State: closed
- Created 8 years ago
- Reactions: 4
- Comments: 15 (2 by maintainers)
Commits related to this issue
- Resolve promise if script was cached and not executed. Should fix IE9's terrible script caching. Addresses #2506. — committed to jscheel/webpack by jscheel 8 years ago
googled a good article about IE loading issues here: http://www.guypo.com/ies-premature-execution-problem/ another solution is- set src attribute after adding element to the dom
looks like i’ve found the solution. Compare to previous 1.0 version scripts are coming with async = true flag. Tried to set it to false and it helps
I’ve branched from 2.1.0-beta.22 (latest versions doesnt work well properly with my config) and there is fix: https://github.com/Markosyan-AR/webpack/commit/8f0efcf7db0e22e9dfa9b300f50b0f1fc7d2d100
also faced my package.json to this branch
"webpack": "https://github.com/Markosyan-AR/webpack/tarball/syncScriptsLoading"
Had a same issue (IE10, webpack 2.1.0-beta.25), I have lazy loaded module, and it only works(additional chunk is loaded) first time i load a page, or after clearing browser cache. Looks like after content is cached during subsequent visits to the page chunk is just never loaded.