-
Couldn't load subscription status.
- Fork 29.7k
Open
Open
Copy link
Labels
CSSRelated to CSS.Related to CSS.
Description
Link to the code that reproduces this issue
https://github.com/qjstuart/nextjs-sass-issue
To Reproduce
- Start the applicaiton
npm run dev - You should be faced with the following error:
## Error Type
Build Error
## Error Message
Error evaluating Node.js code
## Build Output
./ui/TestComponent.module.scss
Error evaluating Node.js code
Error: Can't find stylesheet to import.
╷
1 │ @use "variables" as *;
│ ^^^^^^^^^^^^^^^^^^^^^
╵
ui/TestComponent.module.scss 1:1 root stylesheet
Caused by: Error: Can't find stylesheet to import.
╷
1 │ @use "variables" as *;
│ ^^^^^^^^^^^^^^^^^^^^^
╵
ui/TestComponent.module.scss 1:1 root stylesheet
[at Object.wrapException (/Users/quentin/Code/nextjs-sass-issue/nextjs-sass-issue/node_modules/sass/sass.dart.js:2292:47)]
[at /Users/quentin/Code/nextjs-sass-issue/nextjs-sass-issue/node_modules/sass/sass.dart.js:87606:25]
[at _wrapJsFunctionForAsync_closure.$protected (/Users/quentin/Code/nextjs-sass-issue/nextjs-sass-issue/node_modules/sass/sass.dart.js:4960:15)]
[at _wrapJsFunctionForAsync_closure.call$2 (/Users/quentin/Code/nextjs-sass-issue/nextjs-sass-issue/node_modules/sass/sass.dart.js:37968:12)]
[at _awaitOnObject_closure.call$1 (/Users/quentin/Code/nextjs-sass-issue/nextjs-sass-issue/node_modules/sass/sass.dart.js:37956:32)]
[at Object._rootRunUnary (/Users/quentin/Code/nextjs-sass-issue/nextjs-sass-issue/node_modules/sass/sass.dart.js:5378:18)]
[at StaticClosure.<anonymous> (/Users/quentin/Code/nextjs-sass-issue/nextjs-sass-issue/node_modules/sass/sass.dart.js:124712:16)]
[at _CustomZone.runUnary$2$2 (/Users/quentin/Code/nextjs-sass-issue/nextjs-sass-issue/node_modules/sass/sass.dart.js:39399:39)]
[at _Future__propagateToListeners_handleValueCallback.call$0 (/Users/quentin/Code/nextjs-sass-issue/nextjs-sass-issue/node_modules/sass/sass.dart.js:38457:51)]
[at Object._Future__propagateToListeners (/Users/quentin/Code/nextjs-sass-issue/nextjs-sass-issue/node_modules/sass/sass.dart.js:5170:93)]
Import trace:
Server Component:
./ui/TestComponent.module.scss
./ui/TestComponent.tsx
./app/page.tsx
Next.js version: 16.0.0 (Turbopack)
- Go into
next.config.tsand comment outadditionalData. - Go into
TestComponent.module.scssand modify the@usestatement to use the absolute path to thevariablesdirectory on your machine. - If you updated the
@usestatement with the correct absolute path, the error should go away, because sass can now access the$backgroundvariable.
Current vs. Expected behavior
I expected includePaths and additionalData to make the variables available inside my module files.
Provide environment information
Operating System:
Platform: darwin
Arch: arm64
Version: Darwin Kernel Version 22.3.0: Thu Jan 5 20:48:54 PST 2023; root:xnu-8792.81.2~2/RELEASE_ARM64_T6000
Available memory (MB): 16384
Available CPU cores: 10
Binaries:
Node: 20.19.4
npm: 11.6.2
Yarn: N/A
pnpm: N/A
Relevant Packages:
next: 16.0.0 // Latest available version is detected (16.0.0).
eslint-config-next: N/A
react: 19.2.0
react-dom: 19.2.0
typescript: 5.9.3
Next.js Config:
output: N/AWhich area(s) are affected? (Select all that apply)
CSS
Which stage(s) are affected? (Select all that apply)
next dev (local), next build (local), next start (local)
Additional context
No response
Metadata
Metadata
Assignees
Labels
CSSRelated to CSS.Related to CSS.