material-editor/vite.config.ts

44 lines
1.2 KiB
TypeScript
Raw Normal View History

2025-04-10 16:37:20 +08:00
import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import dts from 'vite-plugin-dts';
import { dirname, resolve } from 'node:path'
import { fileURLToPath } from 'node:url'
const __dirname = dirname(fileURLToPath(import.meta.url))
2025-04-10 16:37:20 +08:00
// https://vite.dev/config/
export default defineConfig({
plugins: [vue(), dts({rollupTypes: true, tsconfigPath: './tsconfig.app.json',insertTypesEntry: true})],
define: { 'process.env.NODE_ENV': '"production"' },
resolve: {
alias: {
// 'vue': path.resolve(__dirname, './node_modules/vue/dist/vue.esm-browser.prod.js'),
// 'pinia': path.resolve(__dirname, './node_modules/pinia/dist/pinia.esm-browser.js'),
}
},
build: {
lib: {
entry: resolve(__dirname, 'src/lib/index.ts'),
name: 'MaterialEditor',
fileName: (format) => `material-editor.${format}.js`,
formats: ['es', 'iife', 'umd']
},
rollupOptions: {
// external: ['vue'],
output: {
globals: {
vue: 'Vue'
},
// manualChunks: (id) => {
// if (id.includes('node_modules'))
// {
// if(/three/.test(id))
// return 'three';
// }
// return null;
// }
},
}
}
2025-04-10 16:37:20 +08:00
})