fix: resolve Windows native SCSS import failures in dev server#44118
Open
anarefolio wants to merge 1 commit intogithub:mainfrom
Open
fix: resolve Windows native SCSS import failures in dev server#44118anarefolio wants to merge 1 commit intogithub:mainfrom
anarefolio wants to merge 1 commit intogithub:mainfrom
Conversation
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.
Contributor
How to review these changes 👓Thank you for your contribution. To review these changes, choose one of the following options: A Hubber will need to deploy your changes internally to review. Table of review linksNote: Please update the URL for your staging server or codespace. This pull request contains code changes, so we will not generate a table of review links. 🤖 This comment is automatically generated. |
This was referenced May 7, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Running
npm run devon Windows (native, no WSL) fails with:Error: Can't find stylesheet to import.
@import './themes/light.scss'
Root cause
Three compounding issues in Next.js's bundled sass-loader:
loadPathswebpackImporterdefaults totrue, webpack loses path context on Windows@primer/primitivesv11 (installed) conflicts with v7 expected by@primer/cssFix
Patch to
next@16.2.3compiled sass-loader that:modern-compilerAPI (enablesloadPaths)webpackImporterdefault tofalsenode_modulestoloadPathsApplied via
patch-package— runs automatically onnpm install.Tested on Windows 11, Node.js 24, native (no WSL).
Note: The contributing guide states "This site can be developed on Windows"
but the current setup fails for native Windows users due to these sass-loader
issues. This fix makes that statement actually true.