diff --git a/packages/vite/src/node/plugins/css.ts b/packages/vite/src/node/plugins/css.ts index bdef18f08980ae..0663898da1d6f9 100644 --- a/packages/vite/src/node/plugins/css.ts +++ b/packages/vite/src/node/plugins/css.ts @@ -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 }