Skip to content

Commit

Permalink
fix(ssr): bypass missing resolve error in SSR (#7164)
Browse files Browse the repository at this point in the history
  • Loading branch information
antfu committed Mar 3, 2022
1 parent 3c0a609 commit a4927c5
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions packages/vite/src/node/plugins/importAnalysis.ts
Expand Up @@ -213,6 +213,10 @@ export function importAnalysisPlugin(config: ResolvedConfig): Plugin {
const resolved = await this.resolve(url, importerFile)

if (!resolved) {
// in ssr, we should let node handle the missing modules
if (ssr) {
return [url, url]
}
this.error(
`Failed to resolve import "${url}" from "${path.relative(
process.cwd(),
Expand Down

0 comments on commit a4927c5

Please sign in to comment.