-
Notifications
You must be signed in to change notification settings - Fork 3
/
vite.config.js
34 lines (33 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
import { defineConfig } from 'vite';
export default defineConfig(({ command }) => ({
// Ensure non-existent files produce 404s
appType: 'mpa',
assetsInclude: ['**/*.lua'],
build: {
rollupOptions: {
output: {
entryFileNames: 'assets/wowser-client-[hash].js',
},
},
},
define: {
// Configure Fengari to not suffix Lua integers with `.0` when string formatted
// See: https://github.com/fengari-lua/fengari/issues/113
'process.env.FENGARICONF': JSON.stringify(JSON.stringify({ LUA_COMPAT_FLOATSTRING: true })),
},
plugins: [
{
transform(src, id) {
// Prevent Fengari from loading Node-only libraries
// See: https://github.com/fengari-lua/fengari/blob/master/src/loslib.js#L480-L489
if (id.includes('fengari')) {
return {
code: src.replaceAll('typeof process', JSON.stringify('undefined'))
};
}
},
},
],
// Do not include local game files into a production build
publicDir: command === 'build' ? false : 'public'
}));