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

Directory .next/static/css is no longer being generated #1491

Closed
3 of 7 tasks
royjosefsson opened this issue Oct 15, 2024 · 11 comments
Closed
3 of 7 tasks

Directory .next/static/css is no longer being generated #1491

royjosefsson opened this issue Oct 15, 2024 · 11 comments
Labels
intentional behaviour This issue describes intentional behaviour that is not a bug nextjs Issue related to NextJS

Comments

@royjosefsson
Copy link

Describe the bug

Issue Summary

Upgrading @vanilla-extract/next-plugin from version 2.3.7 to 2.4.6,
results in the .next/static/css directory no longer being generated.

Steps to Reproduce

  1. Run npm run dev (using Next.js page-router)

Expected Behavior

Running npm run dev in version 2.4.6 generates .next/static/css along with its files inside

Actual Behavior

Running npm run dev in version 2.4.6 doesn't generate .next/static/css

Severity

  • Blocker
  • Critical
  • Major
  • Minor
  • Trivial

Reproduction

https://github.com/royjosefsson/vanilla-extract-issue/tree/main

System Info

System:
  OS: macOS 15.0
  CPU: (10) arm64 Apple M1 Max
  Memory: 2.92 GB / 32.00 GB
  Shell: 5.9 - /bin/zsh
Binaries:
  Node: 20.12.2 - ~/.n/bin/node
  npm: 10.5.0 - ~/.n/bin/npm
  bun: 1.1.24 - ~/.bun/bin/bun
Browsers:
  Chrome: 129.0.6668.101
  Safari: 18.0
npmPackages:
  @vanilla-extract/css: 1.14.2 => 1.14.2 
  @vanilla-extract/dynamic: 2.1.0 => 2.1.0 
  @vanilla-extract/jest-transform: 1.1.1 => 1.1.1 
  @vanilla-extract/next-plugin: 2.3.7 => 2.3.7

Used Package Manager

npm

Logs

No response

Validations

@royjosefsson royjosefsson changed the title Directory .next/static/css is no longer are being generated Directory .next/static/css is no longer being generated Oct 15, 2024
@royjosefsson
Copy link
Author

@mrm007
Would you mind looking at this, is this a bug or are we doing this intentionally?

@mrm007
Copy link
Contributor

mrm007 commented Nov 23, 2024

AFAIK the Next.js integration has not been tested with Next.js 14 and above. I’m surprised the plugin version 2.3.7 still works.

@askoufis might know more.

@mrm007
Copy link
Contributor

mrm007 commented Nov 23, 2024

There's also this issue with Turbopack https://x.com/0_001x_dev/status/1848744288743522561

@askoufis
Copy link
Contributor

askoufis commented Dec 16, 2024

@royjosefsson This is intentional behaviour that was implemented in v2.4.0 of the next plugin (#1365). Does this change affect your application in some way? CSS files are still output during a production build.

@askoufis askoufis added nextjs Issue related to NextJS intentional behaviour This issue describes intentional behaviour that is not a bug and removed pending triage labels Dec 16, 2024
@royjosefsson
Copy link
Author

@askoufis

Goal:
Enable loading theme-specific stylesheets dynamically using a <link> tag in the <head>.


v2.3.0

  • Development and Production:
    CSS files were generated inside .next/static/css, with each file being split into smaller files.👏

v2.3.7

  • Development:
    CSS files were generated inside .next/static/css, with each file being split.👏
  • Production:
    CSS was generated inside .next/static/css, but the files were not split.😞

v2.4.x

  • Development:
    Where is the CSS being generated?🤔
  • Production:
    Where is the CSS being generated?🤔

@askoufis
Copy link
Contributor

askoufis commented Dec 17, 2024

@royjosefsson

In 2.4.x, CSS is now injected into the DOM during development, for reasons described in #1365. In production builds (I tested it in your reproduction), CSS is emitted to .next/static/css.

@askoufis
Copy link
Contributor

@royjosefsson Are you still experiencing this issue? As far as I can tell the .next/static/css is being generated.

@royjosefsson
Copy link
Author

@askoufis
Unfortunately, yes.
How is the .next/static/css being generated on your end?
Could you share your step-by-step process?

Here is a screendump of all the files that's being generated for me:

Image

@royjosefsson
Copy link
Author

@askoufis
From what I understand, this behavior is intentional.

CSS is no longer being generated in .next/static/css when running npx next dev; it’s only generated in .next/static/css during npx next build.

We could consider closing this issue and I'll fix my code to this breaking change

@askoufis
Copy link
Contributor

askoufis commented Jan 28, 2025

@askoufis
From what I understand, this behavior is intentional.

CSS is no longer being generated in .next/static/css when running npx next dev; it’s only generated in .next/static/css during npx next build.

We could consider closing this issue and I'll fix my code to this breaking change

Yes, this is what I have been saying above. This was an intentional change in behaviour. Is there a reason you need the .next/static/css files during development?

@royjosefsson
Copy link
Author

Is there a reason you need the .next/static/css files during development

My primary reason no longer applies to this issue, so I'll create a new one that better aligns with it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
intentional behaviour This issue describes intentional behaviour that is not a bug nextjs Issue related to NextJS
Projects
None yet
Development

No branches or pull requests

3 participants