Skip to content

Turbopack sometimes strips scss imports #76464

@AlessioGr

Description

@AlessioGr

Link to the code that reproduces this issue

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

To Reproduce

  1. pnpm i
  2. pnpm next dev, then open http://localhost:3000
  3. You will notice scss import errors - this is good!
  4. pnpm next dev --turbo, then open http://localhost:3000
  5. 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

Metadata

Metadata

Assignees

No one assigned

    Labels

    TurbopackRelated to Turbopack with Next.js.linear: turbopackConfirmed issue that is tracked by the Turbopack team.locked

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions