From bf539aa1ca54ad423a7e3b96476b5f7b2f28f68e Mon Sep 17 00:00:00 2001 From: Alan Zhang Date: Thu, 9 Jan 2020 16:11:41 +0800 Subject: [PATCH 1/2] =?UTF-8?q?fix(cli):=20=E4=BF=AE=E5=A4=8D=20issue=20#4?= =?UTF-8?q?3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/wxa-cli/src/resolvers/ast/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/wxa-cli/src/resolvers/ast/index.js b/packages/wxa-cli/src/resolvers/ast/index.js index c8c38c38..cc5c7e73 100644 --- a/packages/wxa-cli/src/resolvers/ast/index.js +++ b/packages/wxa-cli/src/resolvers/ast/index.js @@ -126,12 +126,12 @@ export default class ASTManager { case StringLiteralRequire: // path.replaceWithSourceString(`require("${resolved}")`); path.replaceWith( template(`require(SOURCE)`)({SOURCE: t.stringLiteral(resolved)}) ); + path.stop(); break; case ImportDeclaration: path.get('source').replaceWith(t.stringLiteral(resolved)); break; } - path.stop(); } catch (e) { logger.error('解析失败', e); debug('resolve fail %O', e); From 5beb1d3a490bff3ae74a34cb346f01688732f423 Mon Sep 17 00:00:00 2001 From: Alan Zhang Date: Thu, 9 Jan 2020 16:25:16 +0800 Subject: [PATCH 2/2] =?UTF-8?q?fix(cli):=20=E7=9C=81=E6=8E=89=20import=20?= =?UTF-8?q?=E5=90=8E=E7=BB=AD=20StringLiteral=20=E7=9A=84=E5=A4=84?= =?UTF-8?q?=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/wxa-cli/src/resolvers/ast/index.js | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/wxa-cli/src/resolvers/ast/index.js b/packages/wxa-cli/src/resolvers/ast/index.js index cc5c7e73..e7e293ae 100644 --- a/packages/wxa-cli/src/resolvers/ast/index.js +++ b/packages/wxa-cli/src/resolvers/ast/index.js @@ -130,6 +130,7 @@ export default class ASTManager { break; case ImportDeclaration: path.get('source').replaceWith(t.stringLiteral(resolved)); + path.skip(); break; } } catch (e) {