Skip to content

Commit

Permalink
feat: support multiple Webpack runtimes (gregberge#701)
Browse files Browse the repository at this point in the history
* feat: support multiple Webpack runtimes

* namespace chunk loading global in loadableReady

* Change namespace to chunkLoadingGlobal

* Update size snapshot
  • Loading branch information
wvanrensselaer authored Apr 5, 2021
1 parent ed4d3d0 commit 680d1c3
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
12 changes: 6 additions & 6 deletions .size-snapshot.json
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
{
"dist/loadable.cjs.js": {
"bundled": 16354,
"minified": 7304,
"gzipped": 2565
"bundled": 16504,
"minified": 7301,
"gzipped": 2586
},
"dist/loadable.esm.js": {
"bundled": 15975,
"minified": 7000,
"gzipped": 2495,
"bundled": 16125,
"minified": 6997,
"gzipped": 2516,
"treeshaked": {
"rollup": {
"code": 276,
Expand Down
6 changes: 3 additions & 3 deletions src/loadableReady.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ const BROWSER = typeof window !== 'undefined'

export default function loadableReady(
done = () => {},
{ namespace = '' } = {},
{ namespace = '', chunkLoadingGlobal = '__LOADABLE_LOADED_CHUNKS__' } = {},
) {
if (!BROWSER) {
warn('`loadableReady()` must be called in browser only')
Expand Down Expand Up @@ -49,8 +49,8 @@ export default function loadableReady(
let resolved = false

return new Promise(resolve => {
window.__LOADABLE_LOADED_CHUNKS__ = window.__LOADABLE_LOADED_CHUNKS__ || []
const loadedChunks = window.__LOADABLE_LOADED_CHUNKS__
window[chunkLoadingGlobal] = window[chunkLoadingGlobal] || []
const loadedChunks = window[chunkLoadingGlobal]
const originalPush = loadedChunks.push.bind(loadedChunks)

function checkReadyState() {
Expand Down

0 comments on commit 680d1c3

Please sign in to comment.