30
vite.lib.config.ts
Normal file
30
vite.lib.config.ts
Normal file
@@ -0,0 +1,30 @@
|
||||
import { fileURLToPath, URL } from 'node:url'
|
||||
|
||||
import vue from '@vitejs/plugin-vue'
|
||||
import { defineConfig } from 'vite'
|
||||
|
||||
const peerDependencies = ['vue', 'd3', 'ant-design-vue', 'vue3-colorpicker']
|
||||
|
||||
export default defineConfig({
|
||||
plugins: [vue()],
|
||||
resolve: {
|
||||
alias: {
|
||||
'@': fileURLToPath(new URL('./src', import.meta.url)),
|
||||
},
|
||||
},
|
||||
build: {
|
||||
outDir: 'dist',
|
||||
emptyOutDir: true,
|
||||
lib: {
|
||||
entry: fileURLToPath(new URL('./src/index.ts', import.meta.url)),
|
||||
name: 'WaveformAnalysis',
|
||||
formats: ['es', 'cjs'],
|
||||
fileName: (format) => (format === 'es' ? 'index.js' : 'index.cjs'),
|
||||
cssFileName: 'style',
|
||||
},
|
||||
rolldownOptions: {
|
||||
external: (id) =>
|
||||
peerDependencies.some((dependency) => id === dependency || id.startsWith(`${dependency}/`)),
|
||||
},
|
||||
},
|
||||
})
|
||||
Reference in New Issue
Block a user