Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Conditional Dynamic CSS Import Issue in Next.js #69300

Open
AsadRazaJutt1 opened this issue Aug 26, 2024 · 0 comments
Open

Conditional Dynamic CSS Import Issue in Next.js #69300

AsadRazaJutt1 opened this issue Aug 26, 2024 · 0 comments
Labels
bug Issue was opened via the bug report template. create-next-app Related to our CLI tool for quickly starting a new Next.js application.

Comments

@AsadRazaJutt1
Copy link

Link to the code that reproduces this issue

https://codesandbox.io/p/devbox/sparkling-water-g3ns6c?file=%2Fapp%2Flayout.tsx%3A2%2C19

To Reproduce

  1. Click on Codesandbox.
  2. Go to layout.tsx.
    When I load CSS using import "./app.css", it works fine. However, if I try to load it dynamically using const css = "./app.css" and then import(css), it doesn't work.

Current vs. Expected behavior

CSS is not loading when I try like this css = "./app.css" and then import(css).
but when I try like this import "./app.css" style work properly.

Provide environment information

Operating System:
  Platform: win32
  Arch: x64
  Version: Windows 10 Home
  Available memory (MB): 12200
  Available CPU cores: 4
Binaries:
  Node: 18.20.4
  npm: N/A
  Yarn: N/A
  pnpm: 8.15.4
Relevant Packages:
  next: 14.2.5 // There is a newer version (14.2.6) available, upgrade recommended!
  eslint-config-next: 14.2.5
  react: 18.3.1
  react-dom: 18.3.1
  typescript: 5.5.4
Next.js Config:
  output: N/A

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

create-next-app

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

next dev (local)

Additional context

I tested on 15.0.0-canary.130

@AsadRazaJutt1 AsadRazaJutt1 added the bug Issue was opened via the bug report template. label Aug 26, 2024
@github-actions github-actions bot added the create-next-app Related to our CLI tool for quickly starting a new Next.js application. label Aug 26, 2024
@vercel vercel deleted a comment Aug 26, 2024
@vercel vercel deleted a comment Aug 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Issue was opened via the bug report template. create-next-app Related to our CLI tool for quickly starting a new Next.js application.
Projects
None yet
Development

No branches or pull requests

1 participant