diff --git a/packages/vite/src/node/plugins/css.ts b/packages/vite/src/node/plugins/css.ts index 7366c1b093799d..c7856b7e55c5d1 100644 --- a/packages/vite/src/node/plugins/css.ts +++ b/packages/vite/src/node/plugins/css.ts @@ -1600,6 +1600,7 @@ function cleanScssBugUrl(url: string) { if ( // check bug via `window` and `location` global typeof window !== 'undefined' && + typeof location !== 'undefined' && typeof location?.href === 'string' ) { const prefix = location.href.replace(/\/$/, '')