File tree Expand file tree Collapse file tree 1 file changed +18
-0
lines changed
packages/webpack-plugin/lib Expand file tree Collapse file tree 1 file changed +18
-0
lines changed Original file line number Diff line number Diff line change @@ -1726,6 +1726,23 @@ class MpxWebpackPlugin {
17261726 source . add ( '// inject pageconfigmap for screen\n' +
17271727 'var context = (function() { return this })() || Function("return this")();\n' )
17281728 source . add ( `context.__mpxPageConfigsMap = ${ JSON . stringify ( mpx . pageConfigsMap ) } ;\n` )
1729+
1730+ if ( process . env . NODE_ENV !== 'production' ) {
1731+ source . add ( `
1732+ ${ globalObject } .__mpxClearAsyncChunkCache = ${ globalObject } .__mpxClearAsyncChunkCache || function (ids) {
1733+ ids = JSON.stringify(ids)
1734+ var arr = ${ globalObject } ['${ chunkLoadingGlobal } '] || []
1735+ for (var i = arr.length - 1; i >= 0; i--) {
1736+ if (JSON.stringify(arr[i][0]) === ids) {
1737+ arr.splice(i, 1)
1738+ }
1739+ }
1740+ };\n` )
1741+ }
1742+ } else {
1743+ if ( process . env . NODE_ENV !== 'production' ) {
1744+ source . add ( `${ globalObject } .__mpxClearAsyncChunkCache && ${ globalObject } .__mpxClearAsyncChunkCache(${ JSON . stringify ( chunk . ids ) } );\n` )
1745+ }
17291746 }
17301747 source . add ( originalSource )
17311748 compilation . assets [ chunkFile ] = source
@@ -1825,6 +1842,7 @@ try {
18251842
18261843 compilation . chunkGroups . forEach ( ( chunkGroup ) => {
18271844 if ( ! chunkGroup . isInitial ( ) ) {
1845+ isReact ( mpx . mode ) && chunkGroup . chunks . forEach ( ( chunk ) => processChunk ( chunk , false , [ ] ) )
18281846 return
18291847 }
18301848
You can’t perform that action at this time.
0 commit comments