fix(scss, types): 修正打包产物

- 更新SCSS导出方式,支持引用SCSS变量系统(编译为CSS)
- 修复SCSS类名不对应问题
- 修复无types导出问题
- 修改导出路径,避免vite build覆盖其余编译产物
- 支持tree-shaking,不暴露内部路径

BREAKING CHANGES: 1.0.0->2.0.0
This commit is contained in:
tobegold574
2025-11-16 16:32:09 +08:00
parent b74c01340c
commit 3473009b28
42 changed files with 520 additions and 4460 deletions

View File

@@ -12,21 +12,16 @@ export default defineConfig({
'~': fileURLToPath(new URL('./src', import.meta.url))
}
},
css: {
preprocessorOptions: {
// 全局引入variable.scss
scss: {
additionalData: `@import "@/styles/variables.scss";`
}
}
},
build: {
// 构建为库模式
lib: {
entry: fileURLToPath(new URL('./src/index.ts', import.meta.url)),
name: 'KnowAIUI',
name: 'knowaiUi',
fileName: (format) => `knowai-ui.${format}.js`
},
// 输出目录
outDir: 'dist/client',
emptyOutDir: false,
rollupOptions: {
// 不打包进库
external: ['vue'],