Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Avoid variable from empty module name be empty #3026

Merged
merged 8 commits into from Aug 5, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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'
}
}
};