nextjs - ✅(Solved) Fix Turbopack on Windows: Sass @use/@forward imports fail to resolve paths correctly [1 pull requests, 4 comments, 5 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
vercel/next.js#87243Fetched 2026-04-08 02:07:30
View on GitHub
Comments
4
Participants
5
Timeline
23
Reactions
1
Timeline (top)
subscribed ×12commented ×4cross-referenced ×3mentioned ×2

Error Message

Error evaluating Node.js code Error: Can't find stylesheet to import. The error occurs because Turbopack cannot resolve relative @use imports (./css-content) inside node_modules packages on Windows. The error occurs because Turbopack cannot resolve relative @use imports (./css-content) inside node_modules packages on Windows. Error: Can't find stylesheet to import.

Root Cause

The error occurs because Turbopack cannot resolve relative @use imports (./css-content) inside node_modules packages on Windows. Expected behavior: Sass imports should resolve correctly, as they do: On Linux/macOS with Turbopack On Windows with Webpack (next dev --webpack) Additional Issues Discovered

  1. Relative paths in @forward chains fail When a Sass file is loaded through an @forward chain, relative imports within that file fail:

Fix Action

PR fix notes

PR #80: Feat/upgrade

Description (problem / solution / changelog)

Waiting for: https://github.com/vercel/next.js/issues/87243

Changed files

  • backend/src/api/ratings/services/ratings.ts (modified, +1/-0)
  • frontend/Dockerfile (modified, +1/-1)
  • frontend/app/[locale]/ratings/page.tsx (modified, +6/-0)
  • frontend/messages/en.json (modified, +1/-1)
  • frontend/messages/hy.json (modified, +1/-1)
  • frontend/messages/ru.json (modified, +1/-1)
  • frontend/next.config.ts (modified, +7/-3)
  • frontend/package-lock.json (modified, +614/-359)
  • frontend/package.json (modified, +14/-15)
  • frontend/proxy.ts (renamed, +0/-0)
  • frontend/public/external.svg (added, +7/-0)
  • frontend/src/components/articleList/article.module.scss (modified, +2/-0)
  • frontend/src/components/footer/footer.module.scss (modified, +2/-0)
  • frontend/src/components/header/burgerMenu/menu.module.scss (modified, +2/-0)
  • frontend/src/components/header/header.module.scss (modified, +2/-0)
  • frontend/src/components/header/navigation/nav.module.scss (modified, +2/-0)
  • frontend/src/components/trainingScheduleCard/trainingScheduleCard.module.scss (modified, +2/-0)
  • frontend/src/shared/address/address.module.scss (modified, +2/-0)
  • frontend/src/shared/linedTitle/LinedTitle.module.scss (modified, +2/-0)
  • frontend/src/shared/linkButton/moreButton.module.scss (modified, +2/-0)
  • frontend/src/shared/linkItem/linkItem.module.scss (modified, +2/-0)
  • frontend/src/shared/trainersList/trainersList.module.scss (modified, +2/-0)
  • frontend/src/widgets/AboutPage/about.module.scss (modified, +2/-0)
  • frontend/src/widgets/ArticlePage/Article.module.scss (modified, +2/-0)
  • frontend/src/widgets/BranchesPage/branches.module.scss (modified, +2/-0)
  • frontend/src/widgets/ConstactsPage/components/contact/contact.module.scss (modified, +2/-0)
  • frontend/src/widgets/ConstactsPage/contacts.module.scss (modified, +2/-0)
  • frontend/src/widgets/HomePage/components/ChessMapCard/ChessMapCard.module.scss (modified, +2/-0)
  • frontend/src/widgets/HomePage/components/LinedItem/linedItem.module.scss (modified, +2/-0)
  • frontend/src/widgets/RatingPage/Rating.module.scss (modified, +2/-0)
  • frontend/src/widgets/RatingPage/components/grid/Grid.module.scss (modified, +2/-0)
  • frontend/src/widgets/RatingPage/components/grid/Grid.tsx (modified, +2/-2)
  • frontend/src/widgets/RatingPage/components/ratingTable/index.tsx (modified, +2/-1)
  • frontend/src/widgets/RatingPage/components/ratingTable/table.module.scss (modified, +2/-0)
  • frontend/src/widgets/RatingPage/index.tsx (modified, +2/-2)
  • frontend/src/widgets/TrainersPage/components/accordion/accordion.module.scss (modified, +2/-0)
  • frontend/src/widgets/TrainersPage/trainers.module.scss (modified, +2/-0)
  • frontend/src/widgets/UsefulPage/useful.module.scss (modified, +2/-0)
  • frontend/tsconfig.json (modified, +19/-5)

Code Example

Operating System:
  Platform: win32
  Arch: x64
  Version: Windows 11
Binaries:
  Node: 24.x
  npm: 11.x
Relevant Packages:
  next: 16.0.10
  react: 19.x
  sass: 1.95.0
  ag-grid-community: 34.3.1
Next.js Config:
  output: N/A
RAW_BUFFERClick to expand / collapse

Link to the code that reproduces this issue

https://codesandbox.io/p/sandbox/github/vercel/next.js/tree/canary/examples/reproduction-template-pages

To Reproduce

Link to the code that reproduces this issue This issue can be reproduced in any Next.js 16 project on Windows that uses: Sass files with @use or @forward statements Third-party packages with Sass files (e.g., ag-grid-community, bootstrap) To Reproduce Use Windows 10/11 Create a Next.js 16 project with Sass Install a package that uses Sass internally (e.g., ag-grid-community) Import the package's Sass styles Run npm run dev (Turbopack) Minimal reproduction: // src/style.scss @use 'ag-grid-community/styles' as ag; // src/style.scss @use 'ag-grid-community/styles' as ag;

Current vs. Expected behavior

Current behavior: Build fails with errors like: Error evaluating Node.js code Error: Can't find stylesheet to import. ╷ 12 │ @use './css-content'; │ ^^^^^^^^^^^^^^^^^^^^ ╵ node_modules\ag-grid-community\styles\_index.scss 12:1 @use

The error occurs because Turbopack cannot resolve relative @use imports (./css-content) inside node_modules packages on Windows. Expected behavior: Sass imports should resolve correctly, as they do: On Linux/macOS with Turbopack On Windows with Webpack (next dev --webpack) Additional Issues Discovered

  1. Relative paths in @forward chains fail When a Sass file is loaded through an @forward chain, relative imports within that file fail:

`// src/styles.scss @forward 'styles/breakpoints'; // forwards src/styles/_breakpoints.scss

// src/styles/_breakpoints.scss @use './rem' as *; // FAILS - cannot find ./rem even though _rem.scss exists in same directory`

The error occurs because Turbopack cannot resolve relative @use imports (./css-content) inside node_modules packages on Windows. Expected behavior: Sass imports should resolve correctly, as they do: On Linux/macOS with Turbopack On Windows with Webpack (next dev --webpack) Additional Issues Discovered

  1. Relative paths in @forward chains fail When a Sass file is loaded through an @forward chain, relative imports within that file fail:

`// src/styles.scss @forward 'styles/breakpoints'; // forwards src/styles/_breakpoints.scss

// src/styles/_breakpoints.scss @use './rem' as *; // FAILS - cannot find ./rem even though _rem.scss exists in same directory`

Error: Can't find stylesheet to import. ╷ 2 │ @use './rem' as *; │ ^^^^^^^^^^^^^^^^^ ╵ src\styles\_breakpoints.scss 2:1 @forward src\styles.scss 2:1 @use

  1. sassOptions.includePaths doesn't work with Turbopack Configuring sassOptions in next.config.ts has no effect when using Turbopack:

// next.config.ts const nextConfig: NextConfig = { sassOptions: { includePaths: [path.join(__dirname, 'src/styles'), path.join(__dirname, 'src')], }, // ... }

Provide environment information

Operating System:
  Platform: win32
  Arch: x64
  Version: Windows 11
Binaries:
  Node: 24.x
  npm: 11.x
Relevant Packages:
  next: 16.0.10
  react: 19.x
  sass: 1.95.0
  ag-grid-community: 34.3.1
Next.js Config:
  output: N/A

Which area(s) are affected? (Select all that apply)

Turbopack

Which stage(s) are affected? (Select all that apply)

next dev (local)

Additional context

Related Issues #86431 - NextJS 16 version of turbopack failing to resolve bootstrap imports on Windows

Root Cause Analysis The issue appears to be in how Turbopack's Sass integration resolves file paths on Windows: Backslash vs forward slash handling: Windows uses \ as path separator, but Sass expects / in import paths Working directory context: When processing @forward chains, the working directory for resolving relative paths may be incorrect node_modules resolution: Turbopack fails to resolve relative imports within packages in node_modules This issue does not occur on Linux/macOS, suggesting it's specific to Windows path handling in Turbopack's Sass loader.

extent analysis

TL;DR

The most likely fix for the issue is to use a workaround, such as configuring sassOptions to use absolute paths or using a custom Sass loader that handles Windows path separators correctly.

Guidance

  • Verify that the issue is specific to Windows and Turbopack by testing on Linux/macOS or with Webpack.
  • Try configuring sassOptions in next.config.ts to use absolute paths for includePaths to see if it resolves the issue.
  • Consider using a custom Sass loader that handles Windows path separators correctly, such as sass-loader with the implementation option set to dart-sass.
  • Check if updating to the latest version of next, sass, or ag-grid-community resolves the issue.

Example

// next.config.ts
const nextConfig: NextConfig = {
  sassOptions: {
    includePaths: [path.join(__dirname, 'src/styles'), path.join(__dirname, 'src')],
    implementation: require('dart-sass'),
  },
  // ...
}

Notes

  • The issue appears to be specific to Windows and Turbopack, so the workaround may not be necessary on other platforms.
  • The sassOptions configuration may need to be adjusted depending on the specific use case and project structure.

Recommendation

Apply a workaround, such as configuring sassOptions to use absolute paths or using a custom Sass loader, as the issue is likely specific to Windows and Turbopack.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING