-
-
Notifications
You must be signed in to change notification settings - Fork 6.3k
使用vue-cli打包的时候生成了很多0KB的chunk-xxxx.css #3165
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
Comments
请提供复现代码。 |
在单文件组件内部有style标签,没写样式其实没必要生成css chunk的 |
现在只能删除掉组件内部的style标签来解决这个问题 |
不知道是不是vue-template-compiler没做判断的问题 |
the same |
同样的问题困扰很久了。而且不能将项目的CSS文件集中打包到一个文件里。 |
It's caused by |
waiting for PR to release. |
Fixed in vue-loader v15.5.1 |
chunk自动添加的hash如何去掉?
是无效的,求助! |
@orchie https://cli.vuejs.org/zh/config/#filenamehashing 另外请不要在无关 issue 下问问题 |
这个问题在3.3版本依旧存在 |
@endday 请提供复现。请确认你项目中的 vue-loader 版本。 |
|
@endday 同样的 |
@endday 似乎都不是空文件? |
里面的内容是空的,但是有两行空行,估计是这个占了0.02KiB |
@endday 能提供一下实际的复现代码吗?按理来说只有空行应该会被过滤的 |
@sodatea 应该是两个style标签导致的问题,打包的时候只抽取了第一个style标签内的样式 |
@endday 请提供一下复现代码,github repo 或者打包成 zip 都可以 |
@sodatea @jkzing https://github.com/tangdaohai/css-extract-true <style scoped>
.about h1 {
margin-top: 30px;
}
</style> 然后运行 vue-loader版本: dependencies: {
"dependencies": {
"vue": "^2.5.21",
"vue-router": "^3.0.1"
},
"devDependencies": {
"@vue/cli-plugin-babel": "^3.0.3",
"@vue/cli-plugin-eslint": "^3.0.3",
"@vue/cli-service": "^3.0.3",
"@vue/eslint-config-standard": "^4.0.0",
"babel-eslint": "^10.0.1",
"eslint": "^5.8.0",
"eslint-plugin-vue": "^5.0.0",
"vue-template-compiler": "^2.5.21"
}
} |
谢谢老铁热心提供复现 |
好像是因为异步组件加载的机制导致,难道code splitting的优先级要比 vue.config.js 中的 |
关于异步组件中打包多个css的问题,请看这里 #2843 (comment) |
路由组件
引入的组件testStyle
testStyle组件中我使用了两个style标签,其中第一个为空,这就是打包会出现0kb的css的trunk的原因 ps:我已经在其他电脑稳定复现了这种情况 @jkzing 请问结果如何 |
@endday 我感觉应该是你 |
请问是用我上述的那个回复来打包的吗,我vuecli的版本是3.4,vueloader的版本是15.6.2 |
@endday 不是,cli初始化后的。 |
In vendors it still happens |
@ID8323 Please bump |
I updated and the problem persisted. The problem was when doing the next import (an empty css file):
By the way, do you know of an alternative to VueScroll? thanks @jkzing |
现在还有这个问题啊 ,请问什么时候能修复呢? |
The problem was already solved thanks to the comment of the previous colleague. Thank you. |
How to resolve this problem? |
Version
3.2.1
Reproduction link
none
Environment info
Steps to reproduce
使用vue-cli打包项目
What is expected?
不要生成0KB的chunk-xxxx.css
What is actually happening?
生成了很多0KB的chunk-xxxx.css
The text was updated successfully, but these errors were encountered: