Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: the empty string importee should not always be treated as extern…
…al module id (#2733) * Update mergeOptions.ts * Add test for using empty string as virtual module name
- Loading branch information
1 parent
d27ee15
commit 6010bdd
Showing
4 changed files
with
19 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
15 changes: 15 additions & 0 deletions
15
test/function/samples/empty-string-as-module-name/_config.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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'; | ||
} | ||
} | ||
} | ||
] | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
import { importee } from ''; | ||
assert.strictEqual(importee, 'xxx'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export var importee = 'xxx'; |