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

css is not part of the bundle with option cssCodeSplit since 3.1.0 #10137

Closed
7 tasks done
tleunen opened this issue Sep 15, 2022 · 2 comments · Fixed by #10185
Closed
7 tasks done

css is not part of the bundle with option cssCodeSplit since 3.1.0 #10137

tleunen opened this issue Sep 15, 2022 · 2 comments · Fixed by #10185
Labels
feat: css feat: library mode p3-minor-bug An edge case that only affects very specific usage (priority)

Comments

@tleunen
Copy link

tleunen commented Sep 15, 2022

Describe the bug

With Vite 3.1.0 and the option cssCodeSplit, the css is not injected in the JS bundle. Also, the --watch also now produce a different output as well.

Surprisingly enough, in a private project, I was able to reproduce this inconsistency between build and build --watch and the cssCodeSplit option between 3.0.3 and 3.0.4, but in the repro project, it seems it's only starting at 3.1.0

Reproduction

https://github.com/tleunen/vite-build-watch-css-issue

System Info

System:
    OS: macOS 12.5.1
    CPU: (16) x64 Intel(R) Core(TM) i9-9980HK CPU @ 2.40GHz
    Memory: 2.56 GB / 32.00 GB
    Shell: 5.8.1 - /bin/zsh
  Binaries:
    Node: 16.17.0 - ~/.volta/tools/image/node/16.17.0/bin/node
    Yarn: 1.22.19 - ~/.volta/bin/yarn
    npm: 8.15.0 - ~/.volta/tools/image/node/16.17.0/bin/npm
    Watchman: 2022.09.12.00 - /usr/local/bin/watchman
  Browsers:
    Brave Browser: 105.1.43.89
    Chrome: 105.0.5195.125
    Firefox: 104.0.1
    Safari: 15.6.1
  npmPackages:
    @vitejs/plugin-legacy: ^2.0.0 => 2.0.1
    @vitejs/plugin-react: ^2.0.0 => 2.0.1
    vite: 3.0.4 => 3.0.4

Used Package Manager

pnpm

Logs

No response

Validations

@tleunen
Copy link
Author

tleunen commented Sep 15, 2022

Just to add some additional info to this. Despite the option cssCodeSplit, it looks like the css is completely missing from the JS build starting at v3.1.0.

The second issue I'm seeing is that (even before 3.1.0), it looks like the output of build --watch is unpredictive. Sometimes it's the same as build, and other times it seems some build steps are missing. The code is not minified, and the css is missing.

@tleunen tleunen changed the title css is not part of the bundle since 3.1.0 css is not part of the bundle with option cssCodeSplit since 3.1.0 Sep 15, 2022
@flieks
Copy link

flieks commented Sep 15, 2022

I am also having this problem.
cssCodeSplit: false, is not creating 1 bundle of my css + js.

I am using this with build.lib as this is for a web component

@antfu antfu added bug p3-minor-bug An edge case that only affects very specific usage (priority) and removed pending triage labels Sep 18, 2022
@github-actions github-actions bot locked and limited conversation to collaborators Oct 10, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
feat: css feat: library mode p3-minor-bug An edge case that only affects very specific usage (priority)
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants