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 being extracted for systemjs #5901

Open
7 of 8 tasks
shir0u opened this issue Nov 30, 2021 · 3 comments · Fixed by #5902 · May be fixed by #9920
Open
7 of 8 tasks

css is not being extracted for systemjs #5901

shir0u opened this issue Nov 30, 2021 · 3 comments · Fixed by #5902 · May be fixed by #9920
Labels
feat: css p2-nice-to-have Not breaking anything but nice to have (priority)

Comments

@shir0u
Copy link
Contributor

shir0u commented Nov 30, 2021

Describe the bug

According to https://vitejs.dev/guide/features.html#css-code-splitting

Vite automatically extracts the CSS used by modules in an async chunk and generates a separate file for it. The CSS file is automatically loaded via a tag when the associated async chunk is loaded, and the async chunk is guaranteed to only be evaluated after the CSS is loaded to avoid FOUC.

However, when building to systemjs output, this feature seems to be ignored.

Reproduction

Believe this line here should include system or systemjs as well

if (opts.format === 'es' || opts.format === 'cjs') {

Potentially adding to this line as well:

opts.format === 'es'

  • Absolutely sure that the issue is obvious and the provided information is enough to understand the problem.

A PR is available for your convenience #5902 :)
Have tested, and works as expected after applying the patch.

System Info

System:
    OS: macOS 10.15.7
    CPU: (16) x64 Intel(R) Core(TM) i9-9880H CPU @ 2.30GHz
    Memory: 40.56 GB / 64.00 GB
    Shell: 5.7.1 - /bin/zsh
  Binaries:
    Node: 16.13.0 - ~/.nvm/versions/node/v16.13.0/bin/node
    Yarn: 1.22.17 - /usr/local/bin/yarn
    npm: 8.1.0 - ~/.nvm/versions/node/v16.13.0/bin/npm
  Browsers:
    Chrome: 96.0.4664.55
    Firefox: 92.0
    Safari: 14.0
  npmPackages:
    vite:  2.7.0-beta.9

Used Package Manager

yarn

Logs

No error, just the CSS not being extracted.

Validations

@sapphi-red sapphi-red added feat: css p2-nice-to-have Not breaking anything but nice to have (priority) and removed pending triage labels May 5, 2022
@github-actions github-actions bot locked and limited conversation to collaborators May 25, 2022
@sapphi-red
Copy link
Member

Reopening beacause #5902 was reverted by #8654.

@sapphi-red sapphi-red reopened this Jun 19, 2022
@vitejs vitejs unlocked this conversation Jun 19, 2022
@sapphi-red sapphi-red linked a pull request Sep 8, 2022 that will close this issue
8 tasks
@malthoff
Copy link

I have the exact same problem. For systemjs bundle target the CSS is not created. Any chance this gets fixed?

@deadem
Copy link

deadem commented Aug 16, 2023

How about cssCodeSplit to be cssCodeSplit?: boolean | 'extract'; instead of cssCodeSplit?: boolean?

This allows tuning code generation more precisely:

if (opts.format === 'es' || opts.format === 'cjs' || config.build.cssCodeSplit == 'extract') {

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feat: css p2-nice-to-have Not breaking anything but nice to have (priority)
Projects
None yet
4 participants