-
Notifications
You must be signed in to change notification settings - Fork 30.3k
Open
Labels
TurbopackRelated to Turbopack with Next.js.Related to Turbopack with Next.js.
Description
Link to the code that reproduces this issue
https://github.com/rossjrw/turbopack-css-layer-removal-mre
To Reproduce
npm install
npm run build
cat .next/**/*.css
Current vs. Expected behavior
Given the following raw CSS input:
@layer test1;
@import url("https://example.com/test1.css") layer(test1);I expect the NextJS build process to preserve the import layer directive in the output.
This is the case in NextJS 15:
$ cat .next/**/*.css
@layer test1;@import url("https://example.com/test1.css") layer(test1);%
But not in NextJS 16:
$ cat .next/**/*.css
@import "https://example.com/test1.css";
@layer test1;
This looks like a bug introduced by NextJS 16 that exacerbates non-deterministic CSS ordering by removing one of the tools used to control it.
Provide environment information
Operating System:
Platform: darwin
Arch: arm64
Version: Darwin Kernel Version 25.0.0: Mon Aug 25 21:17:56 PDT 2025; root:xnu-12377.1.9~3/RELEASE_ARM64_T6030
Available memory (MB): 18432
Available CPU cores: 11
Binaries:
Node: 24.10.0
npm: 11.6.0
Yarn: N/A
pnpm: N/A
Relevant Packages:
next: 16.1.1 // Latest available version is detected (16.1.1).
eslint-config-next: N/A
react: 19.2.3
react-dom: 19.2.3
typescript: N/A
Next.js Config:
output: N/AWhich area(s) are affected? (Select all that apply)
Turbopack
Which stage(s) are affected? (Select all that apply)
next dev (local), next build (local), next start (local)
Additional context
Tested against canary releases:
- without --turbopack: introduced in v15.6.0-canary.40, which made turbopack the default
- with --turbopack: introduced in v15.3.0-canary.11, which added --turbopack (unknown option in canary.10)
Metadata
Metadata
Assignees
Labels
TurbopackRelated to Turbopack with Next.js.Related to Turbopack with Next.js.