Skip to content

CSS "@import <file> layer()" isn't working #55763

Open
@jangeroo

Description

@jangeroo

Link to the code that reproduces this issue

https://codesandbox.io/p/sandbox/next-js-css-import-layer-bug-h3j5tq

To Reproduce

  1. Create a file with some CSS declarations, e.g. theme.css
  2. In another CSS file used in the app (e.g. global.css) add @import './theme.css' layer(theme)
  3. Start the app if it's not already running

Current vs. Expected behavior

Expected behaviour:
All styles from theme.css are applied.

Actual behaviour:
No styles from theme.css are applied.

Verify canary release

  • I verified that the issue exists in the latest Next.js canary release

Provide environment information

Operating System:
      Platform: darwin
      Arch: arm64
      Version: Darwin Kernel Version 22.6.0: Wed Jul  5 22:22:05 PDT 2023; root:xnu-8796.141.3~6/RELEASE_ARM64_T6000
    Binaries:
      Node: 18.13.0
      npm: 8.19.3
      Yarn: N/A
      pnpm: N/A
    Relevant Packages:
      next: 13.5.3-canary.0
      eslint-config-next: 13.5.2
      react: 18.2.0
      react-dom: 18.2.0
      typescript: 5.2.2
    Next.js Config:
      output: N/A

Which area(s) are affected? (Select all that apply)

Not sure

Additional context

This bug appears in both the old pages router and app router. It does not happen with a bare-bones React application created with created-react-app, where importing css layers works as expected.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugIssue was opened via the bug report template.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions