diff --git a/packages/playground/sass-modern/index.html b/packages/playground/sass-modern/index.html index 578a6c544bfbae..ae5072ed60655e 100644 --- a/packages/playground/sass-modern/index.html +++ b/packages/playground/sass-modern/index.html @@ -1,5 +1,7 @@

SASS: This should be orange

+

Imported SASS string:

+

   

@import dependency w/ sass enrtrypoints: this should be orange

diff --git a/packages/playground/sass-modern/sass.scss b/packages/playground/sass-modern/sass.scss index 077f8091c72c54..10bb68947612a1 100644 --- a/packages/playground/sass-modern/sass.scss +++ b/packages/playground/sass-modern/sass.scss @@ -1,4 +1,4 @@ -//@import 'css-dep'; // package w/ sass entry points +@import 'css-dep'; // package w/ sass entry points .sass { /* injected via vite.config.js */ diff --git a/packages/vite/src/node/plugins/css.ts b/packages/vite/src/node/plugins/css.ts index ca35db39d1d331..5351e532390a3e 100644 --- a/packages/vite/src/node/plugins/css.ts +++ b/packages/vite/src/node/plugins/css.ts @@ -44,6 +44,7 @@ import type { Alias } from 'types/alias' import type { ModuleNode } from '../server/moduleGraph' import { transform, formatMessages } from 'esbuild' import { addToHTMLProxyTransformResult } from './html' +import { pathToFileURL, fileURLToPath } from 'url' // const debug = createDebugger('vite:css') @@ -1114,7 +1115,7 @@ const scss: SassStylePreprocessor = async ( const finalOptions: Sass.StringOptions<'sync'> = { ...(options as Sass.StringOptions<'sync'>), - url: new URL(options.filename), + url: pathToFileURL(options.filename), importers } @@ -1123,7 +1124,7 @@ const scss: SassStylePreprocessor = async ( await getSource(source, options.filename, options.additionalData), finalOptions ) - const deps = result.loadedUrls.map((url) => url.pathname) + const deps = result.loadedUrls.map((url) => fileURLToPath(url)) return { code: result.css,