-
Notifications
You must be signed in to change notification settings - Fork 27.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Turbopack sometimes strips scss imports #76464
Comments
Did some digging into this to reduce the reproduction. Seems there's 2 bugs:
I've narrowed down the second issue in this sandbox: https://codesandbox.io/p/github/payloadcms/payload/csb-cfjgm2/draft/friendly-swirles?file=%2Fpackages%2Fui%2Fpackage.json%3A4%2C41 On that sandbox removing Regardless the package should have |
This makes sense! I tried that, but it currently behaves the same as setting
I was thinking that it's essentially just one bug - just 2 different ways to reproduce it. Incorrectly stripping the scss would both cause incorrect scss imports not to error, and correct scss imports to be ignored.
To clarify, this only happens if those two other conditions are also met:
Thus I would say there is a second bug: the expected behavior of In this case this would be a bug in webpack as well, since webpack has never stripped those scss imports |
The missing build error is not specific to (S)CSS: the same thing happens when doing It appears that if a module marked as |
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:3000pnpm next dev --turbo
, then open http://localhost:3000Current 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
The text was updated successfully, but these errors were encountered: