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

no css files import in bundle when use next.js version 13 app directory(beta) #964

Closed
2 tasks done
igoman2 opened this issue Jan 12, 2023 · 3 comments
Closed
2 tasks done
Labels
nextjs Issue related to NextJS

Comments

@igoman2
Copy link

igoman2 commented Jan 12, 2023

Describe the bug

when i remove pages directory to use app directory instead in next.js 13, random classname apply in element but no css files in bundle and style doesn't work. but it works in pages directory.

Here is example repo.
i use vanilla-extract style in app/page/tsx with classname style.title

Reproduction

https://github.com/igoman2/next13-vanilla-extract

System Info

System:
    OS: macOS 12.3.1
    CPU: (10) arm64 Apple M1 Pro
    Memory: 96.84 MB / 32.00 GB
    Shell: 5.8 - /bin/zsh
  Binaries:
    Node: 16.18.1 - ~/.nvm/versions/node/v16.18.1/bin/node
    Yarn: 1.22.19 - /opt/homebrew/bin/yarn
    npm: 8.19.2 - ~/.nvm/versions/node/v16.18.1/bin/npm
  Browsers:
    Chrome: 108.0.5359.124
    Safari: 15.4
    Safari Technology Preview: 16.4
  npmPackages:
    @vanilla-extract/css: ^1.9.2 => 1.9.2 
    @vanilla-extract/next-plugin: ^2.1.1 => 2.1.1 

 ~/Desktop/next13-vanilla-extract   main 

Used Package Manager

npm

Logs

No response

Validations

@NicoZweifel
Copy link

Could be a duplicate, but maybe you can try some of the things from here #929

@graup graup added nextjs Issue related to NextJS and removed pending triage labels Feb 27, 2023
@JackHowa
Copy link

JackHowa commented Apr 17, 2023

@igoman2 Found an example using app directory beta. Working for me https://github.com/SuttonJack/vanilla-extract-app-dir

I had to force npm i for compatibility with next plugin:

anilla-extract-app-dir % npm i
npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR! 
npm ERR! While resolving: [email protected]
npm ERR! Found: [email protected]
npm ERR! node_modules/next
npm ERR!   next@"13.3.1-canary.6" from the root project
npm ERR! 
npm ERR! Could not resolve dependency:
npm ERR! peer next@">=12.0.5" from @vanilla-extract/[email protected]
npm ERR! node_modules/@vanilla-extract/next-plugin
npm ERR!   dev @vanilla-extract/next-plugin@"^2.1.2" from the root project
npm ERR! 
npm ERR! Fix the upstream dependency conflict, or retry
npm ERR! this command with --force, or --legacy-peer-deps
npm ERR! to accept an incorrect (and potentially broken) dependency resolution.

@askoufis
Copy link
Contributor

askoufis commented Nov 7, 2023

Just tested the reproduction repo with the latest version of the next plugin (v2.3.1) and next 13 (v13.5.6) and the VE style works.

@askoufis askoufis closed this as completed Nov 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
nextjs Issue related to NextJS
Projects
None yet
Development

No branches or pull requests

5 participants