Skip to content

Commit 680d1c3

Browse files
feat: support multiple Webpack runtimes (gregberge#701)
* feat: support multiple Webpack runtimes * namespace chunk loading global in loadableReady * Change namespace to chunkLoadingGlobal * Update size snapshot
1 parent ed4d3d0 commit 680d1c3

File tree

2 files changed

+9
-9
lines changed

2 files changed

+9
-9
lines changed

.size-snapshot.json

+6-6
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
{
22
"dist/loadable.cjs.js": {
3-
"bundled": 16354,
4-
"minified": 7304,
5-
"gzipped": 2565
3+
"bundled": 16504,
4+
"minified": 7301,
5+
"gzipped": 2586
66
},
77
"dist/loadable.esm.js": {
8-
"bundled": 15975,
9-
"minified": 7000,
10-
"gzipped": 2495,
8+
"bundled": 16125,
9+
"minified": 6997,
10+
"gzipped": 2516,
1111
"treeshaked": {
1212
"rollup": {
1313
"code": 276,

src/loadableReady.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ const BROWSER = typeof window !== 'undefined'
88

99
export default function loadableReady(
1010
done = () => {},
11-
{ namespace = '' } = {},
11+
{ namespace = '', chunkLoadingGlobal = '__LOADABLE_LOADED_CHUNKS__' } = {},
1212
) {
1313
if (!BROWSER) {
1414
warn('`loadableReady()` must be called in browser only')
@@ -49,8 +49,8 @@ export default function loadableReady(
4949
let resolved = false
5050

5151
return new Promise(resolve => {
52-
window.__LOADABLE_LOADED_CHUNKS__ = window.__LOADABLE_LOADED_CHUNKS__ || []
53-
const loadedChunks = window.__LOADABLE_LOADED_CHUNKS__
52+
window[chunkLoadingGlobal] = window[chunkLoadingGlobal] || []
53+
const loadedChunks = window[chunkLoadingGlobal]
5454
const originalPush = loadedChunks.push.bind(loadedChunks)
5555

5656
function checkReadyState() {

0 commit comments

Comments
 (0)