-
Notifications
You must be signed in to change notification settings - Fork 30.5k
Labels
CSSRelated to CSS.Related to CSS.
Description
To Reproduce
- Create a Next.js app with any CSS imports
- Set a legacy browser target (e.g. chrome >= 45)
- Run
next build --webpack - Open the app in Chrome 45
Current vs. Expected behavior
Expected Behavior
The insert function should be transpiled to ES5, or at minimum respect the project's browserslist/output.environment webpack configuration.
Actual Behavior
The webpack runtime chunk contains untranspiled modern syntax injected directly as a serialized string from packages/next/src/build/webpack/config/blocks/css/index.ts:
(function(linkTag) {
if (typeof _N_E_STYLE_LOAD === 'function') {
const { href, onload, onerror } = linkTag; // ← not transpiled
...
}
})(linkTag)This crashes on old browsers with Unexpected token {.
Provide environment information
Operating System:
Platform: linux
Arch: x64
Version: #1 SMP PREEMPT_DYNAMIC Thu Jun 5 18:30:46 UTC 2025
Available memory (MB): 31815
Available CPU cores: 22
Binaries:
Node: 22.22.0
npm: 10.9.4
Yarn: 1.22.22
pnpm: N/A
Relevant Packages:
next: 16.1.6 // Latest available version is detected (16.1.6).
eslint-config-next: N/A
react: 19.2.3
react-dom: 19.2.3
typescript: N/A
Next.js Config:
output: export
Done in 0.84s.Which area(s) are affected? (Select all that apply)
CSS
Which stage(s) are affected? (Select all that apply)
next build (local)
Additional context
No response
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
CSSRelated to CSS.Related to CSS.