IndexXuan / vue-cli-plugin-vite

Use vite today, with vue-cli.

Home Page:https://github.com/IndexXuan/vue-cli-plugin-vite

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

vite中的插件在配置文件vue.config.js中引入后不生效

TTcom opened this issue · comments

if you find some problems, please first read the FAQ

if you want some new feature, please know this plugin aims to let codebase work both in vite and vue-cli.
vue.config.js

const styleImport = require('vite-plugin-style-import');

module.exports = {
pluginOptions:{
vite:{
disabledTypeChecker:true,
plugins:[
styleImport({
libs: [
{
libraryName: 'vant',
esModule: true,
resolveStyle: (name) => vant/es/${name}/style,
},
],
})
]
}
}
}
pluginOptions 打印出来是空的

1628237235(1)

可能有语法错误,加下 VITE_DEBUG=true 启动 yarn vite 试试

可能有语法错误,加下 VITE_DEBUG=true 启动 yarn vite 试试

running: vite --config D:\autoproject\vite_vuecli\node_modules\vue-cli-plugin-vite\config\index.ts
TypeError: styleImport is not a function
提示不是一个函数
1628239581(1)
所以应该如果正确的引入vite插件呢?

I solved it

add default

styleImport.default