37 lines
969 B
TypeScript
37 lines
969 B
TypeScript
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))
|
|
|
|
// https://vite.dev/config/
|
|
export default defineConfig({
|
|
plugins: [vue(), dts({rollupTypes: true, tsconfigPath: './tsconfig.app.json',insertTypesEntry: true})],
|
|
build: {
|
|
lib: {
|
|
entry: resolve(__dirname, 'src/lib/index.ts'),
|
|
name: 'MaterialEditor',
|
|
fileName: (format) => `material-editor.${format}.js`,
|
|
formats: ['es']
|
|
},
|
|
rollupOptions: {
|
|
// external: ['vue'],
|
|
output: {
|
|
globals: {
|
|
vue: 'Vue'
|
|
},
|
|
// manualChunks: (id) => {
|
|
// if (id.includes('node_modules'))
|
|
// {
|
|
// if(/three/.test(id))
|
|
// return 'three';
|
|
// }
|
|
// return null;
|
|
// }
|
|
},
|
|
}
|
|
}
|
|
})
|