Skip to content

Turbopack error when importing scss outside of root directory #76956

@AlessioGr

Description

@AlessioGr

Link to the code that reproduces this issue

https://github.com/payloadcms/payload/tree/turbo-bug-reproduction-2

To Reproduce

  1. cd project
  2. pnpm i
  3. pnpm next dev --turbo
  4. Open localhost:3000

You will see the following in your browser:

Image

and in your terminal:

Image

Current vs. Expected behavior

On Webpack, the styles.scss file which is outside the project folder is imported correctly by scss. On Turbopack, this will throw the following error: "Error: An unexpected Turbopack error occurred. Please see the output of next dev for more details."

I see the following problems:

  • Inconsistency between Turbopack and Webpack. While it might be reasonable to disallow importing files from outside the project folder, I think inconsistencies between Turbopack and Webpack should be minimized
  • There is no proper error message.
  • The error message indicates that next dev would provide more details, but it does not.

Provide environment information

Operating System:
  Platform: darwin
  Arch: arm64
  Version: Darwin Kernel Version 24.3.0: Thu Jan  2 20:24:23 PST 2025; root:xnu-11215.81.4~3/RELEASE_ARM64_T6031
  Available memory (MB): 65536
  Available CPU cores: 16
Binaries:
  Node: 22.13.1
  npm: 10.9.2
  Yarn: 1.22.22
  pnpm: 9.15.5
Relevant Packages:
  next: 15.2.2-canary.6 // Latest available version is detected (15.2.2-canary.6).
  eslint-config-next: N/A
  react: 19.0.0
  react-dom: 19.0.0
  typescript: 5.7.3
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

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    TurbopackRelated to Turbopack with Next.js.

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions