Skip to content

Commit

Permalink
Avoid variable from empty module name be empty (#3026)
Browse files Browse the repository at this point in the history
* Create main.js

* Create _config.js

* Update _config.js

* Update _config.js

* Delete main.js

* Update identifierHelpers.ts
  • Loading branch information
LongTengDao authored and lukastaegert committed Aug 5, 2019
1 parent 17eaa43 commit 456f4d2
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/utils/identifierHelpers.ts
Expand Up @@ -24,5 +24,5 @@ export function makeLegal(str: string): string {

if (startsWithDigit(str) || blacklisted[str]) str = `_${str}`;

return str;
return str || '_';
}
19 changes: 19 additions & 0 deletions test/function/samples/avoid-variable-be-empty/_config.js
@@ -0,0 +1,19 @@
module.exports = {
description: 'avoid variable from empty module name be empty',
options: {
input: '',
plugins: [
{
resolveId (importee) {
return '';
},
load (path) {
return 'export default 0;';
},
}
],
output: {
format: 'cjs'
}
}
};

0 comments on commit 456f4d2

Please sign in to comment.