-
-
Notifications
You must be signed in to change notification settings - Fork 6.2k
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
vite 打包之后 css 文件丢失 #3296
Comments
没看懂…… |
set cssCodeSplit value to false,the assets without css file
there is expect a css file in assets |
I meat the same problem |
Same problem here. |
这个问题有解决方案吗 |
可以使用 gulp 这种,在 vite 构建完了之后,再加一个任务用来合并 css |
same here |
Fixes vitejs#3296 Supersedes vitejs#3317 The asset emitting conflict may also exist for other types of assets, but let's fix the CSS one first. The conflict here is due to the `hasEmitted` flag that was originally intended to avoid duplicated CSS for multiple output formats vitejs@6bce108#diff-2cfbd4f4d8c32727cd8e1a561cffbde0b384a3ce0789340440e144f9d64c10f6R262-R263 When the legacy plugin is used, the flag was set to `true` for the emitted CSS of the legacy bundle. But the legacy plugin would remove all its emitted assets later to avoid duplication. So this logic results in no CSS to be actually emitted. In this PR, I used a `__vite_skip_asset_emit__` flag to prevent the CSS `generateBundle` from executing for the legacy build. If other asset emitting plugins encounter similar issues, this flag can be reused.
Fixes #3296 Supersedes #3317 The asset emitting conflict may also exist for other types of assets, but let's fix the CSS one first. The conflict here is due to the `hasEmitted` flag that was originally intended to avoid duplicated CSS for multiple output formats 6bce108#diff-2cfbd4f4d8c32727cd8e1a561cffbde0b384a3ce0789340440e144f9d64c10f6R262-R263 When the legacy plugin is used, the flag was set to `true` for the emitted CSS of the legacy bundle. But the legacy plugin would remove all its emitted assets later to avoid duplication. So this logic results in no CSS to be actually emitted. In this PR, I used a `__vite_skip_asset_emit__` flag to prevent the CSS `generateBundle` from executing for the legacy build. If other asset emitting plugins encounter similar issues, this flag can be reused.
@sodatea 使用 |
这个问题要等到 2.8 发布(应该快了)才能修复 |
Describe the bug
在使用 @vitejs/plugin-legacy 插件,并且配置 build.cssCodeSplit 为 true 时,打包之后 css 文件丢失,当
build.cssCodeSplit
设置为true之后,打包后 css 正常如上述,加上
build.cssCodeSplit
这个配置为 false 后,打包后,css 文件就没了把
build.cssCodeSplit
这个配置为 true 后,打包后 css 正常Reproduction
https://github.com/keuby/bug-demo.git
System Info
Used package manager: yarn
The text was updated successfully, but these errors were encountered: