kailong321200875 / vue-element-plus-admin

A backend management system based on vue3, typescript, element-plus, and vite
https://element-plus-admin.cn/
MIT License
2.74k stars 664 forks source link

如果自行使用TableV2,并引入TableV2FixedDir时,会导致无法打包 #545

Open Akemi-Madoka opened 5 days ago

Akemi-Madoka commented 5 days ago

使用最新的2.9版本, 在任一组件引入TableV2FixedDir并使用,然后进行打包 即可触发报错:

ERROR error during build: 10:26:29
[vite]: Rollup failed to resolve import "E:/GIT/test/vue-element-plus-admin-2.9.0/node_modules/.pnpm/element-plus@2.7.7_vue@3.4.32typescript@5.5.3/node_modules/element-plus/es/components/table-v2-fixed-dir/style/css" from "E:/GIT/test/vue-element-plus-admin-2.9.0/src/views/Authorization/User/User.vue?vue&type=script&setup=true&lang.tsx". This is most likely unintended because it can break your application at runtime. If you do want to externalize this module explicitly add it to build.rollupOptions.external

Akemi-Madoka commented 5 days ago

另: 引入”ElAutoResizer“组件时,也会触发类型的报错,请尽可能处理

Akemi-Madoka commented 5 days ago

经过测试,问题来源于vite.config.ts中的'vite-plugin-style-import'自动拼接样式路径导致的问题,所以只有当打包参数VITE_USE_ALL_ELEMENT_PLUS_STYLE=false才会触发,即默认的"build:pro"