-
-
Notifications
You must be signed in to change notification settings - Fork 7.3k
Labels
Description
Describe the bug
When compose from scss, scss treats as css.
// style.module.scss
.hi {
composes: foo from "./foo.module.scss"
}
// foo.module.scss
.foo {
// comment
background: red;
}
// comment
will throws
CssSyntaxError:foo.module.scss:2:8: Unknown word
You tried to parse SCSS with the standard CSS parser; try again with the postcss-scss parser
Reproduction
https://github.com/Thiry1/vite-bug-reprodocution
System Info
System:
OS: macOS 12.5.1
CPU: (8) x64 Intel(R) Core(TM) i7-1068NG7 CPU @ 2.30GHz
Memory: 4.23 GB / 32.00 GB
Shell: 3.2.57 - /bin/bash
Binaries:
Node: 16.13.0 - ~/.nodebrew/current/bin/node
Yarn: 1.22.15 - ~/.nodebrew/current/bin/yarn
npm: 8.1.0 - ~/.nodebrew/current/bin/npm
Browsers:
Chrome: 105.0.5195.125
Chrome Canary: 108.0.5338.0
Firefox: 104.0.1
Firefox Developer Edition: 90.0
Safari: 15.6.1
npmPackages:
vite: ^3.1.4 => 3.1.4
Used Package Manager
yarn
Logs
Click to expand!
❯ vite --debug
vite:config bundled config file loaded in 109.00ms +0ms
vite:esbuild init tsconfck (root: /Users/kei_sakamoto/Documents/GitHub/vite-bug-reprodocutin) +0ms
vite:esbuild init tsconfck (root: /Users/kei_sakamoto/Documents/GitHub/vite-bug-reprodocutin) +1ms
vite:esbuild init tsconfck end +2ms
vite:esbuild init tsconfck end +0ms
vite:config using resolved config: {
vite:config optimizeDeps: {
vite:config disabled: 'build',
vite:config force: undefined,
vite:config esbuildOptions: { preserveSymlinks: undefined }
vite:config },
vite:config server: {
vite:config preTransformRequests: true,
vite:config middlewareMode: false,
vite:config fs: { strict: true, allow: [Array], deny: [Array] }
vite:config },
vite:config configFile: '/Users/kei_sakamoto/Documents/GitHub/vite-bug-reprodocutin/vite.config.ts',
vite:config configFileDependencies: [
vite:config '/Users/kei_sakamoto/Documents/GitHub/vite-bug-reprodocutin/vite.config.ts'
vite:config ],
vite:config inlineConfig: {
vite:config root: undefined,
vite:config base: undefined,
vite:config mode: undefined,
vite:config configFile: undefined,
vite:config logLevel: undefined,
vite:config clearScreen: undefined,
vite:config optimizeDeps: { force: undefined },
vite:config server: {}
vite:config },
vite:config root: '/Users/kei_sakamoto/Documents/GitHub/vite-bug-reprodocutin',
vite:config base: '/',
vite:config resolve: { alias: [ [Object], [Object] ] },
vite:config publicDir: '/Users/kei_sakamoto/Documents/GitHub/vite-bug-reprodocutin/public',
vite:config cacheDir: '/Users/kei_sakamoto/Documents/GitHub/vite-bug-reprodocutin/node_modules/.vite',
vite:config command: 'serve',
vite:config mode: 'development',
vite:config ssr: {
vite:config format: 'esm',
vite:config target: 'node',
vite:config optimizeDeps: { disabled: true, esbuildOptions: [Object] }
vite:config },
vite:config isWorker: false,
vite:config mainConfig: null,
vite:config isProduction: false,
vite:config plugins: [
vite:config 'vite:pre-alias',
vite:config 'alias',
vite:config 'vite:modulepreload-polyfill',
vite:config 'vite:optimized-deps',
vite:config 'vite:resolve',
vite:config 'vite:html-inline-proxy',
vite:config 'vite:css',
vite:config 'vite:esbuild',
vite:config 'vite:json',
vite:config 'vite:wasm-helper',
vite:config 'vite:worker',
vite:config 'vite:asset',
vite:config 'vite:wasm-fallback',
vite:config 'vite:define',
vite:config 'vite:css-post',
vite:config 'vite:worker-import-meta-url',
vite:config 'vite:dynamic-import-vars',
vite:config 'vite:import-glob',
vite:config 'vite:client-inject',
vite:config 'vite:import-analysis'
vite:config ],
vite:config build: {
vite:config target: [ 'es2020', 'edge88', 'firefox78', 'chrome87', 'safari13' ],
vite:config polyfillModulePreload: true,
vite:config outDir: 'dist',
vite:config assetsDir: 'assets',
vite:config assetsInlineLimit: 4096,
vite:config cssCodeSplit: true,
vite:config cssTarget: [ 'es2020', 'edge88', 'firefox78', 'chrome87', 'safari13' ],
vite:config sourcemap: false,
vite:config rollupOptions: {},
vite:config minify: 'esbuild',
vite:config terserOptions: {},
vite:config write: true,
vite:config emptyOutDir: null,
vite:config manifest: false,
vite:config lib: false,
vite:config ssr: false,
vite:config ssrManifest: false,
vite:config reportCompressedSize: true,
vite:config chunkSizeWarningLimit: 500,
vite:config watch: null,
vite:config commonjsOptions: { include: [Array], extensions: [Array] },
vite:config dynamicImportVarsOptions: { warnOnError: true, exclude: [Array] }
vite:config },
vite:config preview: {
vite:config port: undefined,
vite:config strictPort: undefined,
vite:config host: undefined,
vite:config https: undefined,
vite:config open: undefined,
vite:config proxy: undefined,
vite:config cors: undefined,
vite:config headers: undefined
vite:config },
vite:config env: { BASE_URL: '/', MODE: 'development', DEV: true, PROD: false },
vite:config assetsInclude: [Function: assetsInclude],
vite:config logger: {
vite:config hasWarned: false,
vite:config info: [Function: info],
vite:config warn: [Function: warn],
vite:config warnOnce: [Function: warnOnce],
vite:config error: [Function: error],
vite:config clearScreen: [Function: clearScreen],
vite:config hasErrorLogged: [Function: hasErrorLogged]
vite:config },
vite:config packageCache: Map(0) {},
vite:config createResolver: [Function: createResolver],
vite:config worker: {
vite:config format: 'iife',
vite:config plugins: [
vite:config 'vite:pre-alias',
vite:config 'alias',
vite:config 'vite:modulepreload-polyfill',
vite:config 'vite:optimized-deps',
vite:config 'vite:resolve',
vite:config 'vite:html-inline-proxy',
vite:config 'vite:css',
vite:config 'vite:esbuild',
vite:config 'vite:json',
vite:config 'vite:wasm-helper',
vite:config 'vite:worker',
vite:config 'vite:asset',
vite:config 'vite:wasm-fallback',
vite:config 'vite:define',
vite:config 'vite:css-post',
vite:config 'vite:worker-import-meta-url',
vite:config 'vite:dynamic-import-vars',
vite:config 'vite:import-glob',
vite:config 'vite:client-inject',
vite:config 'vite:import-analysis'
vite:config ],
vite:config rollupOptions: {},
vite:config getSortedPlugins: [Function: getSortedPlugins],
vite:config getSortedPluginHooks: [Function: getSortedPluginHooks]
vite:config },
vite:config appType: 'spa',
vite:config experimental: { importGlobRestoreExtension: false, hmrPartialAccept: false },
vite:config getSortedPlugins: [Function: getSortedPlugins],
vite:config getSortedPluginHooks: [Function: getSortedPluginHooks]
vite:config } +8ms
vite:deps Hash is consistent. Skipping. Use --force to override. +0ms
VITE v3.1.4 ready in 283 ms
➜ Local: http://localhost:5173/
➜ Network: use --host to expose
vite:spa-fallback Rewriting GET / to /index.html +0ms
vite:time 50.51ms /index.html +0ms
vite:resolve 5.79ms /@vite/client -> /Users/kei_sakamoto/Documents/GitHub/vite-bug-reprodocutin/node_modules/vite/dist/client/client.mjs +0ms
vite:resolve 1.48ms /lib -> /Users/kei_sakamoto/Documents/GitHub/vite-bug-reprodocutin/lib/index.jsx +11ms
vite:load 1.88ms [fs] /lib +0ms
vite:load 14.64ms [fs] /@vite/client +6ms
vite:resolve 6.99ms react -> /Users/kei_sakamoto/Documents/GitHub/vite-bug-reprodocutin/node_modules/.vite/deps/react.js?v=070109ce +42ms
vite:resolve 5.28ms /node_modules/.vite/deps/react.js?v=070109ce -> /Users/kei_sakamoto/Documents/GitHub/vite-bug-reprodocutin/node_modules/.vite/deps/react.js?v=070109ce +6ms
vite:import-analysis /node_modules/.vite/deps/react.js?v=070109ce needs interop +0ms
vite:resolve 0.15ms react-dom -> /Users/kei_sakamoto/Documents/GitHub/vite-bug-reprodocutin/node_modules/.vite/deps/react-dom.js?v=070109ce +47ms
vite:resolve 0.08ms /node_modules/.vite/deps/react-dom.js?v=070109ce -> /Users/kei_sakamoto/Documents/GitHub/vite-bug-reprodocutin/node_modules/.vite/deps/react-dom.js?v=070109ce +1ms
vite:import-analysis /node_modules/.vite/deps/react-dom.js?v=070109ce needs interop +48ms
vite:resolve 0.64ms ./style.module.scss -> /Users/kei_sakamoto/Documents/GitHub/vite-bug-reprodocutin/lib/style.module.scss +2ms
vite:resolve 0.31ms /lib/style.module.scss -> /Users/kei_sakamoto/Documents/GitHub/vite-bug-reprodocutin/lib/style.module.scss +1ms
vite:import-analysis 69.67ms [3 imports rewritten] lib/index.jsx +6ms
vite:transform 97.95ms /lib +0ms
vite:time 106.14ms /lib +250ms
vite:optimize-deps load /Users/kei_sakamoto/Documents/GitHub/vite-bug-reprodocutin/node_modules/.vite/deps/react.js +0ms
vite:optimize-deps load /Users/kei_sakamoto/Documents/GitHub/vite-bug-reprodocutin/node_modules/.vite/deps/react-dom.js +1ms
vite:resolve 0.70ms @vite/env -> /Users/kei_sakamoto/Documents/GitHub/vite-bug-reprodocutin/node_modules/vite/dist/client/env.mjs +16ms
vite:resolve 0.22ms /node_modules/vite/dist/client/env.mjs -> /Users/kei_sakamoto/Documents/GitHub/vite-bug-reprodocutin/node_modules/vite/dist/client/env.mjs +0ms
vite:import-analysis 5.54ms [1 imports rewritten] node_modules/vite/dist/client/client.mjs +14ms
vite:transform 95.97ms /@vite/client +13ms
vite:time 136.28ms /@vite/client +12ms
vite:load 13.76ms [fs] /node_modules/vite/dist/client/env.mjs +122ms
vite:load 35.03ms [fs] /lib/style.module.scss +11ms
vite:load 41.94ms [plugin] /node_modules/.vite/deps/react.js?v=070109ce +7ms
vite:resolve 0.84ms ./chunk-V6FDF5WS.js -> /Users/kei_sakamoto/Documents/GitHub/vite-bug-reprodocutin/node_modules/.vite/deps/chunk-V6FDF5WS.js?v=070109ce +39ms
vite:resolve 0.19ms /node_modules/.vite/deps/chunk-V6FDF5WS.js?v=070109ce -> /Users/kei_sakamoto/Documents/GitHub/vite-bug-reprodocutin/node_modules/.vite/deps/chunk-V6FDF5WS.js?v=070109ce +1ms
vite:import-analysis 17.56ms [1 imports rewritten] node_modules/.vite/deps/react.js?v=070109ce +51ms
vite:transform 18.35ms /node_modules/.vite/deps/react.js?v=070109ce +52ms
vite:optimize-deps load /Users/kei_sakamoto/Documents/GitHub/vite-bug-reprodocutin/node_modules/.vite/deps/chunk-V6FDF5WS.js +60ms
vite:import-analysis 0.10ms [no imports] node_modules/vite/dist/client/env.mjs +3ms
vite:transform 30.36ms /node_modules/vite/dist/client/env.mjs +2ms
vite:load 63.62ms [plugin] /node_modules/.vite/deps/react-dom.js?v=070109ce +22ms
vite:import-analysis 18.28ms [1 imports rewritten] node_modules/.vite/deps/react-dom.js?v=070109ce +24ms
vite:transform 21.82ms /node_modules/.vite/deps/react-dom.js?v=070109ce +24ms
vite:load 46.62ms [plugin] /node_modules/.vite/deps/chunk-V6FDF5WS.js?v=070109ce +44ms
vite:import-analysis 0.66ms [no imports] node_modules/.vite/deps/chunk-V6FDF5WS.js?v=070109ce +24ms
vite:transform 1.56ms /node_modules/.vite/deps/chunk-V6FDF5WS.js?v=070109ce +24ms
vite:cache [304] /node_modules/vite/dist/client/env.mjs +0ms
vite:time 0.56ms /node_modules/vite/dist/client/env.mjs +522ms
vite:resolve 0.29ms ./foo.module.scss -> null +0ms
vite:resolve 0.10ms ./foo.module.scss -> null +0ms
vite:resolve 0.07ms ./foo.module.scss -> null +0ms
CssSyntaxError: /Users/kei_sakamoto/Documents/GitHub/vite-bug-reprodocutin/lib/foo.module.scss:2:8: Unknown word
You tried to parse SCSS with the standard CSS parser; try again with the postcss-scss parser
at Input.error (/Users/kei_sakamoto/Documents/GitHub/vite-bug-reprodocutin/node_modules/postcss/lib/input.js:148:16)
at Parser.unknownWord (/Users/kei_sakamoto/Documents/GitHub/vite-bug-reprodocutin/node_modules/postcss/lib/parser.js:540:22)
at Parser.decl (/Users/kei_sakamoto/Documents/GitHub/vite-bug-reprodocutin/node_modules/postcss/lib/parser.js:219:16)
at Parser.other (/Users/kei_sakamoto/Documents/GitHub/vite-bug-reprodocutin/node_modules/postcss/lib/parser.js:128:18)
at Parser.parse (/Users/kei_sakamoto/Documents/GitHub/vite-bug-reprodocutin/node_modules/postcss/lib/parser.js:72:16)
at parse (/Users/kei_sakamoto/Documents/GitHub/vite-bug-reprodocutin/node_modules/postcss/lib/parse.js:11:12)
at new LazyResult (/Users/kei_sakamoto/Documents/GitHub/vite-bug-reprodocutin/node_modules/postcss/lib/lazy-result.js:133:16)
at Processor.process (/Users/kei_sakamoto/Documents/GitHub/vite-bug-reprodocutin/node_modules/postcss/lib/processor.js:28:14)
at Core.load (file:///Users/kei_sakamoto/Documents/GitHub/vite-bug-reprodocutin/node_modules/vite/dist/node/chunks/dep-55b95cd5.js:1547:76)
at file:///Users/kei_sakamoto/Documents/GitHub/vite-bug-reprodocutin/node_modules/vite/dist/node/chunks/dep-55b95cd5.js:1621:19 {
reason: 'Unknown word',
file: '/Users/kei_sakamoto/Documents/GitHub/vite-bug-reprodocutin/lib/foo.module.scss',
source: '.foo {\n // foo\n font-weight: bold;\n}\n',
line: 2,
column: 8,
endLine: 2,
endColumn: 11,
input: {
line: 2,
column: 8,
endLine: 2,
endColumn: 11,
source: '.foo {\n // foo\n font-weight: bold;\n}\n',
url: 'file:///Users/kei_sakamoto/Documents/GitHub/vite-bug-reprodocutin/lib/foo.module.scss',
file: '/Users/kei_sakamoto/Documents/GitHub/vite-bug-reprodocutin/lib/foo.module.scss'
}
}
vite:hmr [detected api usage] lib/style.module.scss +0ms
vite:import-analysis 0.55ms [0 imports rewritten] lib/style.module.scss +525ms
vite:transform 598.49ms /lib/style.module.scss +525ms
vite:time 104.61ms /lib/style.module.scss +105ms
vite:deps ✨ static imports crawl ended +1m
Validations
- Follow our Code of Conduct
- Read the Contributing Guidelines.
- Read the docs.
- Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
- Make sure this is a Vite issue and not a framework-specific issue. For example, if it's a Vue SFC related bug, it should likely be reported to vuejs/core instead.
- Check that this is a concrete bug. For Q&A open a GitHub Discussion or join our Discord Chat Server.
- The provided reproduction is a minimal reproducible example of the bug.
bartels, JonasFolletete, edgarsn, 1mku, iyinchao and 7 morebasmilius, bartels, MorayM, 1mku and Singloo