Closed DCLangX closed 2 years ago
这里面涉及到了 vant vite-plugin-style-import vite 都有问题,我会在稍后给 vite 提 pr。目前可以这么写
import {Button} from 'vant'
import '/node_modules/vant/es/button/style/index.js' // 按需导入样式,不建议用需要写多次
import 'vant/lib/index.css'// 整个导入
import 'vant/lib/index.css'
好的👍
最新版本已支持,可以直接用按需导入语法引入。fix by https://github.com/zhangyuang/ssr/commit/62d936b62dd47365be8eb27564628adc139b619d
详细描述你的问题
打扰了大佬,,想问下vite对ui框架的支持是不是还在开发中啊,我用的vite+vue3+nestjs,照文档单文件引入Button,发现样式没有被导入
试着引入lib或es的样式,
import 'vant/lib/button/style'
或import 'vant/es/button/style'
,都报错了,提示Cannot find module 'vant/lib/button/style' imported from ...等等
又照着vant文档,在config.ts里配了自动导入样式的插件打包也是提示