From caeabfc213bc35ceaddea9865949ea2e5e556a02 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=BE=99=E8=85=BE=E9=81=93?= Date: Sun, 3 Mar 2019 00:24:10 +0800 Subject: [PATCH 1/2] Update mergeOptions.ts --- src/utils/mergeOptions.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/utils/mergeOptions.ts b/src/utils/mergeOptions.ts index f2f86f76e61..8f8c2629a98 100644 --- a/src/utils/mergeOptions.ts +++ b/src/utils/mergeOptions.ts @@ -168,7 +168,7 @@ function addUnknownOptionErrors( function getCommandOptions(rawCommandOptions: GenericConfigObject): GenericConfigObject { const command = { ...rawCommandOptions }; - command.external = (rawCommandOptions.external || '').split(','); + command.external = rawCommandOptions.external ? rawCommandOptions.external.split(',') : []; if (rawCommandOptions.globals) { command.globals = Object.create(null); From 7468e939eaa6ba479f6661f114dfc6563288bd22 Mon Sep 17 00:00:00 2001 From: Lukas Taegert-Atkinson Date: Mon, 4 Mar 2019 06:41:40 +0100 Subject: [PATCH 2/2] Add test for using empty string as virtual module name --- .../empty-string-as-module-name/_config.js | 15 +++++++++++++++ .../samples/empty-string-as-module-name/main.js | 2 ++ .../empty-string-as-module-name/main.js#.js | 1 + 3 files changed, 18 insertions(+) create mode 100644 test/function/samples/empty-string-as-module-name/_config.js create mode 100644 test/function/samples/empty-string-as-module-name/main.js create mode 100644 test/function/samples/empty-string-as-module-name/main.js#.js diff --git a/test/function/samples/empty-string-as-module-name/_config.js b/test/function/samples/empty-string-as-module-name/_config.js new file mode 100644 index 00000000000..dfbc2595b37 --- /dev/null +++ b/test/function/samples/empty-string-as-module-name/_config.js @@ -0,0 +1,15 @@ +module.exports = { + description: 'allows using empty string as a valid module name', + options: { + external: () => false, + plugins: [ + { + resolveId(importee, importer) { + if (importee === '') { + return importer + '#.js'; + } + } + } + ] + } +}; diff --git a/test/function/samples/empty-string-as-module-name/main.js b/test/function/samples/empty-string-as-module-name/main.js new file mode 100644 index 00000000000..29634821528 --- /dev/null +++ b/test/function/samples/empty-string-as-module-name/main.js @@ -0,0 +1,2 @@ +import { importee } from ''; +assert.strictEqual(importee, 'xxx'); diff --git a/test/function/samples/empty-string-as-module-name/main.js#.js b/test/function/samples/empty-string-as-module-name/main.js#.js new file mode 100644 index 00000000000..221b08850db --- /dev/null +++ b/test/function/samples/empty-string-as-module-name/main.js#.js @@ -0,0 +1 @@ +export var importee = 'xxx';