Skip to content

_N_E_STYLE_LOAD insert function in CSS loader is not transpiled, breaks on old browsers #90518

@FeNoMeNa

Description

@FeNoMeNa

To Reproduce

  1. Create a Next.js app with any CSS imports
  2. Set a legacy browser target (e.g. chrome >= 45)
  3. Run next build --webpack
  4. 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

Metadata

Metadata

Assignees

No one assigned

    Labels

    CSSRelated to CSS.

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions