Skip to content

Commit

Permalink
fix: fix types errors (#2726)
Browse files Browse the repository at this point in the history
  • Loading branch information
g-plane authored Mar 27, 2021
1 parent fa30f76 commit 9716582
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
6 changes: 2 additions & 4 deletions packages/vite/src/node/plugins/importAnalysis.ts
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ export function importAnalysisPlugin(config: ResolvedConfig): Plugin {

const rewriteStart = Date.now()
await init
let imports: ImportSpecifier[] = []
let imports: readonly ImportSpecifier[] = []
try {
imports = parseImports(source)[0]
} catch (e) {
Expand Down Expand Up @@ -310,10 +310,8 @@ export function importAnalysisPlugin(config: ResolvedConfig): Plugin {
const isDynamicImport = dynamicIndex >= 0

// static import or valid string in dynamic import
const isLiteralId = !!specifier

// If resolvable, let's resolve it
if (isLiteralId) {
if (!!specifier) {
// skip external / data uri
if (isExternalUrl(specifier) || isDataUrl(specifier)) {
continue
Expand Down
2 changes: 1 addition & 1 deletion packages/vite/src/node/plugins/importAnalysisBuild.ts
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ export function buildImportAnalysisPlugin(config: ResolvedConfig): Plugin {

await init

let imports: ImportSpecifier[] = []
let imports: readonly ImportSpecifier[] = []
try {
imports = parseImports(source)[0]
} catch (e) {
Expand Down

0 comments on commit 9716582

Please sign in to comment.