Link to the code that reproduces this issue
https://github.com/anarefolio/docs
To Reproduce
- Windows 10/11, Node.js 24, native (no WSL)
- Clone https://github.com/github/docs
- Run
npm install
- Run
npm run dev
- Open browser at localhost:4000
Result: Error: Can't find stylesheet to import.
@import './themes/light.scss'
node_modules@primer\css\color-modes\index.scss
Root cause: Next.js bundled sass-loader defaults to legacy API
with webpackImporter:true, which loses path context on Windows when
resolving SCSS imports inside node_modules.
Workaround found and documented here:
github/docs#44118
The fix requires patching next/dist/compiled/sass-loader/cjs.js to:
- Use modern-compiler API instead of legacy
- Set webpackImporter default to false
- Add node_modules to loadPaths
Current vs. Expected behavior
Current: Running npm run dev on Windows native (no WSL) fails immediately with:
Error: Can't find stylesheet to import.
@import './themes/light.scss'
node_modules@primer\css\color-modes\index.scss
Expected: SCSS imports from node_modules resolve correctly on Windows,
as they do on Linux/macOS. The contributing guide for github/docs explicitly
states "This site can be developed on Windows" but it cannot.
Provide environment information
Operating System:
Platform: win32
Arch: x64
Version: Windows 11 Home
Available memory (MB): 16070
Available CPU cores: 12
Binaries:
Node: 24.15.0
npm: 11.12.1
Relevant Packages:
next: 16.2.3
react: 19.2.5
react-dom: 19.2.5
typescript: 6.0.2
Which area(s) are affected? (Select all that apply)
CSS
Which stage(s) are affected? (Select all that apply)
next dev (local)
Additional context
Note: Tested on next@16.2.3. The workaround documented in
github/docs#44118 confirms the root cause is in the compiled
sass-loader configuration, not version-specific.
Link to the code that reproduces this issue
https://github.com/anarefolio/docs
To Reproduce
npm installnpm run devResult: Error: Can't find stylesheet to import.
@import './themes/light.scss'
node_modules@primer\css\color-modes\index.scss
Root cause: Next.js bundled sass-loader defaults to legacy API
with webpackImporter:true, which loses path context on Windows when
resolving SCSS imports inside node_modules.
Workaround found and documented here:
github/docs#44118
The fix requires patching next/dist/compiled/sass-loader/cjs.js to:
Current vs. Expected behavior
Current: Running
npm run devon Windows native (no WSL) fails immediately with:Error: Can't find stylesheet to import.
@import './themes/light.scss'
node_modules@primer\css\color-modes\index.scss
Expected: SCSS imports from node_modules resolve correctly on Windows,
as they do on Linux/macOS. The contributing guide for github/docs explicitly
states "This site can be developed on Windows" but it cannot.
Provide environment information
Which area(s) are affected? (Select all that apply)
CSS
Which stage(s) are affected? (Select all that apply)
next dev (local)
Additional context
Note: Tested on next@16.2.3. The workaround documented in
github/docs#44118 confirms the root cause is in the compiled
sass-loader configuration, not version-specific.