-
Notifications
You must be signed in to change notification settings - Fork 30k
Closed
Labels
Description
Link to the code that reproduces this issue
https://github.com/GlebKodrik/scss-nextjs/tree/master
To Reproduce
- Use Next.js version 16.0.1 with the --webpack flag.
- Add the following configuration to next.config.ts:
sassOptions: {
additionalData: '@use "app/styles" as *;',
},
- Start the development server using next dev or make a production build with next build.
- An error occurs during the build process.
Can't find stylesheet to import.
╷
1 │ @use "app/styles" as *;
Current vs. Expected behavior
Expected Behavior: The configuration with sassOptions.additionalData should work identically to version 15.5.2, where it successfully injects the global SCSS module.
Current Behavior: In version 16.0.1, adding the sassOptions.additionalData line immediately causes a build error. This is a regression, as the same configuration works without any issues in version 15.5.2.
Provide environment information
Operating System:
Platform: darwin
Arch: arm64
Version: Darwin Kernel Version 23.6.0
Binaries:
Node: 20.17.0
npm: 10.8.2
Yarn: 1.22.22
pnpm: 9.10.0
Relevant Packages:
"next": "^16.0.1",
"react": "19.1.0",
"react-dom": "19.1.0"
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)
Additional context
The issue is specific to the new version 16.0.1. Rolling back to 15.5.2 resolves the problem immediately.
The project uses the --webpack configuration flag.
The goal of the additionalData option is to globally import an SCSS module (app/styles) into every Sass file in the project.