/
vite.config.js
40 lines (37 loc) · 947 Bytes
/
vite.config.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
import { resolve } from 'path';
import { defineConfig } from 'vite';
import { babel } from '@rollup/plugin-babel';
const LIB_NAME = 'el-animate';
const LIB_NAME_CAMEL = 'ELAnimate';
export default defineConfig({
root: './playground',
build: {
outDir: '../dist',
emptyOutDir: true,
sourcemap: true,
lib: {
entry: resolve(__dirname, 'src/index.ts'),
formats: ['cjs', 'es', 'iife', 'umd'],
name: LIB_NAME_CAMEL,
fileName: (format) => {
if (format === 'cjs') {
return `${LIB_NAME}.cjs`;
}
return `${LIB_NAME}.${format}.js`;
},
},
rollupOptions: {
plugins: [
babel({
babelHelpers: 'bundled',
exclude: 'node_modules/**',
extensions: ['.js', '.ts'],
}),
],
output: {
exports: 'named',
},
},
},
server: { hmr: { clientPort: process.env.CODESPACES ? 443 : undefined } },
});