浏览器报错:
未捕获的类型错误:无法解析模块说明符“antd-mobile”。相对引用必须以“/”、“./”或“../”开头。
我的配置:
import reactRefresh from '@vitejs/plugin-react-refresh'
import {defineConfig} from 'vite'
import cdn from 'vite-plugin-cdn'
// https://vitejs.dev/config/
export default defineConfig({
base: '',
css: {
preprocessorOptions: {
less: {
javascriptEnabled: true,
}
}
},
plugins: [
reactRefresh(),
cdn({
modules: [
{
name: 'antd-mobile',
url: 'https://cdnjs.cloudflare.com/ajax/libs/antd-mobile/2.3.4/antd-mobile.min.js'
}
]
})
],
build: {
rollupOptions: {
external: ['antd-mobile'],
}
}
})