-
Notifications
You must be signed in to change notification settings - Fork 29.1k
Description
Link to the code that reproduces this issue
https://github.com/payloadcms/payload/tree/turbo-bug-reproduction
To Reproduce
pnpm i
pnpm next dev
, then open http://localhost:3000- You will notice scss import errors - this is good!
pnpm next dev --turbo
, then open http://localhost:3000- No scss import errors. This is a problem
Current vs. Expected behavior
I encountered an issue in Turbopack where some components do not import their SCSS files, despite having an import './index.scss'
statement.
To verify, I tested importing a non-existent SCSS file: Webpack correctly throws an error, but Turbopack does not.
This suggests that Turbopack’s AST parser may be stripping out SCSS imports under specific conditions. In particular, the problem arises when importing a component that imports another component (which imports SCSS) from a monorepo package whose package.json has "sideEffects": false
.
If I import the component directly from the app folder, skipping the monorepo package that has "sideEffects": false
, it works.
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.0-canary.74 // Latest available version is detected (15.2.0-canary.74).
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