Skip to content

Commit 35783aa

Browse files
committed
fix: resolve Windows SCSS import failures in dev server
On Windows, Next.js's bundled sass-loader fails to resolve SCSS imports from node_modules due to path resolution issues with resolve-url-loader and the legacy sass API. This patch to next@16.2.3's compiled sass-loader makes three changes: 1. Forces modern-compiler API instead of legacy, enabling loadPaths support 2. Disables webpackImporter (defaults to false) so sass uses its own native resolver instead of webpack's, which loses path context on Windows 3. Adds node_modules to loadPaths so package-style @import statements like @primer/css and @primer/primitives resolve correctly Also adds loadPaths to sassOptions in next.config.ts as the proper configuration surface for this fix. Fixes dev server startup on Windows (native, no WSL required). Tested on Windows 11 with Node.js 24.
1 parent affd6e0 commit 35783aa

2 files changed

Lines changed: 14 additions & 0 deletions

File tree

next.config.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,11 @@ const config: NextConfig = {
3737
sassOptions: {
3838
quietDeps: true,
3939
silenceDeprecations: ['legacy-js-api', 'import', 'global-builtin', 'color-4-api'],
40+
loadPaths: [
41+
path.join(process.cwd(), 'node_modules'),
42+
path.join(process.cwd(), 'node_modules/@primer/css/node_modules'),
43+
process.cwd(),
44+
],
4045
},
4146
// Don't use automatic Next.js logging in dev unless the log level is `debug` or higher
4247
// See `src/observability/logger/README.md` for log levels

0 commit comments

Comments
 (0)