fix: 修复 dev 模式下 extract-css 插件不存在导致的报错
dev 模式不加载 mini-css-extract-plugin,需先判断插件是否存在再调用 tap() Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
parent
d5d82d3488
commit
18224299aa
@ -35,10 +35,13 @@ module.exports = defineConfig({
|
||||
|
||||
// Element Plus 按需导入时,不同路由 chunk 的 CSS 导入顺序不一致,
|
||||
// 但这不影响最终样式(specificity 规则优先),忽略该警告
|
||||
config.plugin('extract-css').tap(args => {
|
||||
args[0].ignoreOrder = true
|
||||
return args
|
||||
})
|
||||
// extract-css 仅在生产构建时存在,dev 模式下跳过
|
||||
if (config.plugins.has('extract-css')) {
|
||||
config.plugin('extract-css').tap(args => {
|
||||
args[0].ignoreOrder = true
|
||||
return args
|
||||
})
|
||||
}
|
||||
},
|
||||
devServer: {
|
||||
port: 8080,
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user