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

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

Closed
TTcom opened this issue Aug 6, 2021 · 4 comments
Closed

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

TTcom opened this issue Aug 6, 2021 · 4 comments
Labels
feature feature request

Comments

@TTcom
Copy link

TTcom commented Aug 6, 2021

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)

@IndexXuan
Copy link
Owner

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

@IndexXuan
Copy link
Owner

@TTcom
Copy link
Author

TTcom commented Aug 6, 2021

可能有语法错误,加下 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插件呢?

@TTcom
Copy link
Author

TTcom commented Aug 6, 2021

I solved it

add default

styleImport.default

@TTcom TTcom closed this as completed Aug 6, 2021
@IndexXuan IndexXuan added the feature feature request label Sep 11, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature feature request
Projects
None yet
Development

No branches or pull requests

2 participants