diff --git a/packages/taro-loader/src/independentPage.ts b/packages/taro-loader/src/independentPage.ts index ef8d9b2382bc..c75bab47f62e 100644 --- a/packages/taro-loader/src/independentPage.ts +++ b/packages/taro-loader/src/independentPage.ts @@ -29,11 +29,16 @@ export default function (this: webpack.loader.LoaderContext) { const componentPath = isNeedRawLoader ? `${raw}!${this.resourcePath}` : this.request.split('!').slice(1).join('!') + const runtimePath = Array.isArray(options.runtimePath) ? options.runtimePath : [options.runtimePath] + const setReconciler = runtimePath.reduce((res, item) => { + return res + `import '${item}'\n` + }, '') const prerender = ` if (typeof PRERENDER !== 'undefined') { global._prerender = inst }` - return `import { createPageConfig, ${creator}, window } from '@tarojs/runtime' + return `${setReconciler} +import { createPageConfig, ${creator}, window } from '@tarojs/runtime' import component from ${stringify(componentPath)} ${importFrameworkStatement} var config = ${configString}; diff --git a/packages/taro-loader/src/native-component.ts b/packages/taro-loader/src/native-component.ts index 0d904c457799..e4f45810cf6d 100644 --- a/packages/taro-loader/src/native-component.ts +++ b/packages/taro-loader/src/native-component.ts @@ -20,12 +20,17 @@ export default function (this: webpack.loader.LoaderContext) { const componentPath = isNeedRawLoader ? `${raw}!${this.resourcePath}` : this.request.split('!').slice(thisLoaderIndex + 1).join('!') + const runtimePath = Array.isArray(options.runtimePath) ? options.runtimePath : [options.runtimePath] + const setReconciler = runtimePath.reduce((res, item) => { + return res + `import '${item}'\n` + }, '') const prerender = ` if (typeof PRERENDER !== 'undefined') { global._prerender = inst }` - return `import { createNativeComponentConfig } from '@tarojs/runtime' + return `${setReconciler} +import { createNativeComponentConfig } from '@tarojs/runtime' import component from ${stringify(componentPath)} ${importFrameworkStatement} var config = ${configString}; diff --git a/packages/taro-mini-runner/src/plugins/MiniPlugin.ts b/packages/taro-mini-runner/src/plugins/MiniPlugin.ts index d5a96f692e96..e4a013794e4c 100644 --- a/packages/taro-mini-runner/src/plugins/MiniPlugin.ts +++ b/packages/taro-mini-runner/src/plugins/MiniPlugin.ts @@ -282,7 +282,8 @@ export default class TaroMiniPlugin { name: module.name, prerender: this.prerenderPages.has(module.name), config: this.filesConfig, - appConfig: this.appConfig + appConfig: this.appConfig, + runtimePath: this.options.runtimePath } }) } @@ -294,7 +295,8 @@ export default class TaroMiniPlugin { options: { framework, name: module.name, - prerender: this.prerenderPages.has(module.name) + prerender: this.prerenderPages.has(module.name), + runtimePath: this.options.runtimePath } }) }