diff --git a/packages/vite/src/node/plugins/css.ts b/packages/vite/src/node/plugins/css.ts index 824dc8d571c91e..d1a54f05c9e754 100644 --- a/packages/vite/src/node/plugins/css.ts +++ b/packages/vite/src/node/plugins/css.ts @@ -217,6 +217,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 }