Files
bim_engine/vite.config.ts
2026-03-26 09:34:21 +08:00

53 lines
1.2 KiB
TypeScript

import { defineConfig } from 'vite';
import dts from 'vite-plugin-dts';
import { resolve } from 'path';
import cssInjectedByJs from 'vite-plugin-css-injected-by-js';
import pkg from './package.json';
export default defineConfig(() => {
return {
plugins: [
// 移除 Vue 插件
dts({
include: ['src'],
exclude: [
'src/**/*.es.js',
'**/*.es.js'
],
rollupTypes: false,
logLevel: 'warn', // 只显示警告和错误
}),
cssInjectedByJs()
],
// 开发服务器配置
server: {
port: 3000,
host: '0.0.0.0',
open: '/demo/index.html',
allowedHosts: true,
},
define: {
__APP_VERSION__: JSON.stringify(pkg.version),
},
build: {
lib: {
entry: resolve(__dirname, 'src/index.ts'),
name: 'IflowEngine',
fileName: (format) => `iflow-engine.${format}.js`,
},
rollupOptions: {
external: ['opentype.js'],
output: {
globals: {
'opentype.js': '{}',
},
// 禁用代码分割,将所有代码打包到一个文件
inlineDynamicImports: true,
},
},
sourcemap: true,
emptyOutDir: true,
},
};
});