Skip to content

Commit

Permalink
fix: add a warning if css urls not exist during build time (fix #9800) (
Browse files Browse the repository at this point in the history
#10331)

Co-authored-by: 翠 / green <green@sapphi.red>
  • Loading branch information
Megrax and sapphi-red authored Oct 24, 2022
1 parent cffe5c9 commit 9f268da
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions packages/vite/src/node/plugins/css.ts
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,12 @@ export function cssPlugin(config: ResolvedConfig): Plugin {
if (resolved) {
return fileToUrl(resolved, config, this)
}
if (config.command === 'build') {
// #9800 If we cannot resolve the css url, leave a warning.
config.logger.warnOnce(
`\n${url} referenced in ${id} didn't resolve at build time, it will remain unchanged to be resolved at runtime`
)
}
return url
}

Expand Down

0 comments on commit 9f268da

Please sign in to comment.