From 567273508cd5c5266347c94052f703a2cbc2db93 Mon Sep 17 00:00:00 2001 From: wangxinjian01 Date: Tue, 28 Jul 2020 18:56:04 +0800 Subject: [PATCH] =?UTF-8?q?feat(service/runner):=20=E5=B0=8F=E7=A8=8B?= =?UTF-8?q?=E5=BA=8Fconfig=E9=85=8D=E7=BD=AE=E6=94=AF=E6=8C=81entryFileNam?= =?UTF-8?q?e=E6=8C=87=E5=AE=9A=E5=85=A5=E5=8F=A3=E6=96=87=E4=BB=B6(#7187)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/taro-mini-runner/src/plugins/MiniPlugin.ts | 3 ++- packages/taro-service/src/Config.ts | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/packages/taro-mini-runner/src/plugins/MiniPlugin.ts b/packages/taro-mini-runner/src/plugins/MiniPlugin.ts index 10e6d81eeaec..79953effbe39 100644 --- a/packages/taro-mini-runner/src/plugins/MiniPlugin.ts +++ b/packages/taro-mini-runner/src/plugins/MiniPlugin.ts @@ -294,8 +294,9 @@ export default class TaroMiniPlugin { */ getAppEntry (compiler: webpack.Compiler) { const originalEntry = compiler.options.entry as webpack.Entry + const entryFileName = Object.keys(originalEntry)[0] compiler.options.entry = {} - return path.resolve(this.context, originalEntry.app[0]) + return path.resolve(this.context, originalEntry[entryFileName]?.[0]) } getChangedFiles (compiler) { diff --git a/packages/taro-service/src/Config.ts b/packages/taro-service/src/Config.ts index 3e12cec717f9..537cc9b2da0b 100644 --- a/packages/taro-service/src/Config.ts +++ b/packages/taro-service/src/Config.ts @@ -58,7 +58,7 @@ export default class Config { const sourceDirName = initialConfig.sourceRoot || SOURCE_DIR const outputDirName = initialConfig.outputRoot || OUTPUT_DIR const sourceDir = path.join(this.appPath, sourceDirName) - const entryName = ENTRY + const entryName = initialConfig.entryFileName || ENTRY const entryFilePath = resolveScriptPath(path.join(sourceDir, entryName)) const entry = {