Skip to content

Commit

Permalink
fix: do not generate import specifier if not needed
Browse files Browse the repository at this point in the history
  • Loading branch information
yyx990803 committed Jan 29, 2021
1 parent 470ceb8 commit e438802
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions packages/vite/src/node/plugins/importAnalysis.ts
Original file line number Diff line number Diff line change
Expand Up @@ -523,6 +523,10 @@ function transformCjsImport(
}) as any).body[0] as Node

if (node.type === 'ImportDeclaration') {
if (!node.specifiers.length) {
return `import "${url}"`
}

const importNames: ImportNameSpecifier[] = []
for (const spec of node.specifiers) {
if (
Expand Down

0 comments on commit e438802

Please sign in to comment.