-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvite.config.js
43 lines (41 loc) · 1.04 KB
/
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
41
42
43
import { resolve } from 'path';
import { defineConfig } from 'vite';
import { transform } from 'esbuild';
export default defineConfig({
// config options
plugins: [minifyEs()],
build: {
target: "modules",
minify: "esbuild",
lib: {
entry: [
resolve(__dirname, "src/index.ts"),
],
name: "BOX2D",
fileName: 'chibiland-box2d',
formats: ["iife", "umd", "es"]
},
rollupOptions: {
external: ["chibiengine"],
output: {
globals: {
"chibiengine": "CHIBIENGINE"
}
}
}
}
});
function minifyEs() {
return {
name: 'minifyEs',
renderChunk: {
order: 'post',
async handler(code, chunk, outputOptions) {
if (outputOptions.format === 'es') {
return await transform(code, { minify: true });
}
return code;
},
}
};
}