-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathvite.config.js
39 lines (37 loc) · 1.32 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
import { defineConfig } from "vite";
// if you use tiled maps
// there is a collision between react w/ typescript .tsx
// and tiled tileset files .tsx
// this forces vite to not interpret tsx as react
const tiledPlugin = () => {
return {
name: 'tiled-tileset-plugin',
resolveId: {
order: 'pre',
handler(sourceId, importer, options) {
if (!sourceId.endsWith(".tsx")) return;
return { id: 'tileset:' + sourceId, external: 'relative' }
}
}
};
}
export default defineConfig({
base: './', // optionally give a base path, useful for itch.io to serve relative instead of the default absolut
plugins: [tiledPlugin()], // hint vite that tiled tilesets should be treated as external
// currently excalibur plugins are commonjs
// this forces vite to keep things from bundling ESM together with commonjs
optimizeDeps: {
exclude: ["excalibur"],
},
build: {
assetsInlineLimit: 0, // excalibur cannot handle inlined xml in prod mode
sourcemap: true,
// Vite uses rollup currently for prod builds so a separate config is needed
// to keep vite from bundling ESM together with commonjs
rollupOptions: {
output: {
format: 'umd'
}
}
}
});