Skip to content

Commit

Permalink
fix(importAnalysis): early null return on undefined
Browse files Browse the repository at this point in the history
  • Loading branch information
saurabhdaware committed May 2, 2022
1 parent 968ff69 commit 1d34d51
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions packages/vite/src/node/plugins/importAnalysis.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ import {
optimizedDepNeedsInterop
} from '../optimizer'

const isDebug = !!process.env.DEBUG
const isDebug = true
const debug = createDebugger('vite:import-analysis')

const clientDir = normalizePath(CLIENT_DIR)
Expand Down Expand Up @@ -167,9 +167,10 @@ export function importAnalysisPlugin(config: ResolvedConfig): Plugin {
}

const { moduleGraph } = server
// since we are already in the transform phase of the importer, it must
// have been loaded so its entry is guaranteed in the module graph.
const importerModule = moduleGraph.getModuleById(importer)!
const importerModule = moduleGraph.getModuleById(importer)
if (!importerModule) {
return null
}

if (!imports.length) {
importerModule.isSelfAccepting = false
Expand Down

0 comments on commit 1d34d51

Please sign in to comment.