Initial commit: 上传整个code目录
This commit is contained in:
@@ -0,0 +1,58 @@
|
||||
import process from 'node:process';
|
||||
import { fileURLToPath, URL } from 'node:url';
|
||||
import sharePlugin from '@lingshu/vite-plugin-share';
|
||||
import vue from '@vitejs/plugin-vue';
|
||||
import vueJsx from '@vitejs/plugin-vue-jsx';
|
||||
import UnoCSS from 'unocss/vite';
|
||||
import { defineConfig } from 'vite';
|
||||
import dts from 'vite-plugin-dts';
|
||||
import vueDevTools from 'vite-plugin-vue-devtools';
|
||||
// https://vite.dev/config/
|
||||
export default defineConfig((configEnv) => {
|
||||
// 检查是否运行 lib 命令
|
||||
const isLibBuild = process.env.npm_lifecycle_event === 'lib';
|
||||
|
||||
const config: any = {
|
||||
plugins: [
|
||||
vue(),
|
||||
vueJsx(),
|
||||
vueDevTools(),
|
||||
dts({
|
||||
copyDtsFiles: true,
|
||||
exclude: ['node_modules', 'dist'],
|
||||
rollupTypes: true,
|
||||
tsconfigPath: './tsconfig.app.json',
|
||||
}),
|
||||
UnoCSS(),
|
||||
sharePlugin(configEnv),
|
||||
],
|
||||
resolve: {
|
||||
alias: {
|
||||
'@': fileURLToPath(new URL('./src', import.meta.url)),
|
||||
'@busi-comp': fileURLToPath(new URL('../business-components/src', import.meta.url)),
|
||||
'@lingshu/types': fileURLToPath(new URL('../types', import.meta.url)),
|
||||
},
|
||||
},
|
||||
server: {
|
||||
port: 3000,
|
||||
},
|
||||
};
|
||||
|
||||
// 只有运行 lib 命令时才应用 build 配置
|
||||
if (isLibBuild) {
|
||||
config.build = {
|
||||
cssCodeSplit: true,
|
||||
lib: {
|
||||
entry: fileURLToPath(new URL('./src/index.ts', import.meta.url)),
|
||||
formats: ['es'],
|
||||
fileName: 'index',
|
||||
},
|
||||
minify: 'oxc',
|
||||
rollupOptions: {
|
||||
external: ['@lingshu/lowcode-create'],
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
return config;
|
||||
});
|
||||
Reference in New Issue
Block a user