34 lines
1.2 KiB
TypeScript
34 lines
1.2 KiB
TypeScript
import vue from '@vitejs/plugin-vue';
|
||
import process from 'node:process';
|
||
import { fileURLToPath, URL } from 'node:url';
|
||
import { defineConfig } from 'vite';
|
||
import topLevelAwait from 'vite-plugin-top-level-await';
|
||
|
||
// https://vite.dev/config/
|
||
export default defineConfig({
|
||
plugins: [vue(), topLevelAwait()],
|
||
base: process.env.NODE_ENV === 'production' ? '/tmp/car/' : '/',
|
||
resolve: {
|
||
alias: {
|
||
'@': fileURLToPath(new URL('./src', import.meta.url))
|
||
}
|
||
},
|
||
build: {
|
||
target: ['edge90', 'chrome90', 'firefox90', 'safari15'],
|
||
lib: {
|
||
entry: "src/3d/load3d.ts", // 入口文件路径
|
||
// entry: 'src/components/design/Design.ts', // 入口文件路径
|
||
name: "bjscar", // 全局变量名(UMD 格式时生效)
|
||
fileName: (format) => `bjscar.${format}.js`, // 输出文件名模板
|
||
// formats: ['es', 'umd', 'system'] // 输出格式(ES 模块、UMD 等)
|
||
// formats: ['es'] // 输出格式(ES 模块)
|
||
formats: ["umd"], // 输出格式(ES 模块、UMD 等)
|
||
},
|
||
rollupOptions: {
|
||
// 确保外部化处理那些你不想打包进库的依赖
|
||
// external: ['vue', /^@babylonjs\//, 'three', 'three-addons']
|
||
external: ['vue', 'three', 'three-addons']
|
||
}
|
||
}
|
||
})
|