赞
踩
❤️砥砺前行,不负余光,永远在路上❤️
组件发布之后使用可能会遇到报错,错误信息:Uncaught TypeError:Cannot read properties of null (reading ‘isCE’)
at Cc (1cl-test-ui.mjs:1564:9)
在vite.config.js中添加代码
rollupOptions: { //解决isCE
external: ["vue"],
output: {
globals: {
vue: 'vue'
}
}
},
完整的vite.config.js
import { defineConfig } from 'vite' import vue from '@vitejs/plugin-vue' // https://vitejs.dev/config/ export default defineConfig({ plugins: [vue()], build: { rollupOptions: { //解决isCE external: ["vue"], output: { globals: { vue: 'vue' } } }, lib: { entry: "./packages/index.js", name: 'lcl-test-ui' } } })
参考:https://www.bilibili.com/video/BV1s5411U7sd
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。