diff --git a/packages/webpack-plugin/lib/index.js b/packages/webpack-plugin/lib/index.js index 185490931e..ca9b11d4f9 100644 --- a/packages/webpack-plugin/lib/index.js +++ b/packages/webpack-plugin/lib/index.js @@ -651,7 +651,7 @@ class MpxWebpackPlugin { }, (chunk, set) => { compilation.addRuntimeModule( chunk, - new LoadAsyncChunkModule(this.options.rnConfig && this.options.rnConfig.asyncChunk && this.options.rnConfig.asyncChunk.timeout) + new LoadAsyncChunkModule() ) return true }) diff --git a/packages/webpack-plugin/lib/react/LoadAsyncChunkModule.js b/packages/webpack-plugin/lib/react/LoadAsyncChunkModule.js index af70b461a2..73bde6a076 100644 --- a/packages/webpack-plugin/lib/react/LoadAsyncChunkModule.js +++ b/packages/webpack-plugin/lib/react/LoadAsyncChunkModule.js @@ -3,9 +3,8 @@ const Template = require('webpack/lib/Template') const HelperRuntimeModule = require('webpack/lib/runtime/HelperRuntimeModule') class LoadAsyncChunkRuntimeModule extends HelperRuntimeModule { - constructor (timeout) { + constructor () { super('load async chunk') - this.timeout = timeout || 10000 } generate () { @@ -32,7 +31,7 @@ class LoadAsyncChunkRuntimeModule extends HelperRuntimeModule { ]), '}', 'inProgress[url] = [done]', - 'var callback = function (type, result) {', + 'var callback = function (type) {', Template.indent([ 'var event = {', Template.indent([ @@ -45,7 +44,6 @@ class LoadAsyncChunkRuntimeModule extends HelperRuntimeModule { ]), Template.indent([ 'var doneFns = inProgress[url]', - 'clearTimeout(timeout)', 'delete inProgress[url]', `doneFns && doneFns.forEach(${runtimeTemplate.returningFunction( 'fn(event)', @@ -53,7 +51,6 @@ class LoadAsyncChunkRuntimeModule extends HelperRuntimeModule { )})` ]), '}', - `var timeout = setTimeout(callback.bind(null, 'timeout'), ${this.timeout})`, `var loadChunkAsyncFn = ${RuntimeGlobals.global}.__mpx.config.rnConfig && ${RuntimeGlobals.global}.__mpx.config.rnConfig.loadChunkAsync`, 'try {', Template.indent([