rspack: [Bug]: Can't import scss: `module build failed` (treated like js code)
System Info
System:
OS: Linux 6.11 Ubuntu 24.10 24.10 (Oracular Oriole)
CPU: (32) x64 AMD Ryzen 9 7950X 16-Core Processor
Memory: 43.21 GB / 60.88 GB
Shell: 5.2.32 - /bin/bash
Binaries:
Node: 22.14.0 - ~/.volta/tools/image/node/22.14.0/bin/node
Yarn: 4.9.0 - ~/.volta/tools/image/yarn/4.7.0/bin/yarn
Details
start build started...
error Build error:
File: /home/kubijo/dev/rspack-pnp-css-build-bug/src/styles/carbon/carbon.global.scss:1:1
× Module build failed:
╰─▶ × × Module build failed:
│ ╰─▶ × expected "{".
│ │ ╷
│ │ 1 │ 'use strict';
│ │ │ ^
│ │ ╵
│ │ ../../../@carbon/colors/lib/index.js 1:13 @forward
│ │ ../../../@carbon/styles/scss/_colors.scss 8:1 @forward
│ │ ../../../@carbon/styles/index.scss 10:1 @forward
│ │ ../../../@carbon/react/index.scss 9:1 @use
│ │ ../../../../src/styles/carbon/carbon.global.scss 6:1 root stylesheet
│
│
@ ./src/app/App.tsx
@ ./src/app/index.tsx
@ ./src/index.tsx
I also tried adding having an extra module rule like this, but it did not help.
{
test: /\.global\.scss$/,
type: 'css',
use: [
{
loader: 'sass-loader',
options: { api: 'modern-compiler', implementation: 'sass-embedded' },
},
],
},
Reproduce link
https://github.com/kubijo/rspack-pnp-css-build-bug/tree/carbon
Reproduce Steps
git clone --branch carbon https://github.com/kubijo/rspack-pnp-css-build-bug.git
yarn install
make dev
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Comments: 17 (7 by maintainers)
Now v1.3.6 is released
Yes, bundler suppose to try
index.sass/scsswhen the resolve is come from a sass file