-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathvite.config.js
72 lines (70 loc) · 1.66 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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
import { defineConfig } from 'vite';
import { resolve } from 'path';
import { fileURLToPath } from 'url';
import monacoEditorPlugin from 'vite-plugin-monaco-editor';
import { viteStaticCopy } from 'vite-plugin-static-copy';
import yaml from '@rollup/plugin-yaml';
import { nodePolyfills } from 'vite-plugin-node-polyfills';
import { createHtmlPlugin } from 'vite-plugin-html';
// Get the directory name equivalent in ESM
const __dirname = fileURLToPath(new URL('.', import.meta.url));
export default defineConfig({
plugins: [
monacoEditorPlugin({}),
nodePolyfills(),
yaml(),
createHtmlPlugin({
inject: {
data: {
injectAnalytics: true,
analytics: {
path: resolve(__dirname, 'src/analytics.html')
}
}
}
}),
viteStaticCopy({
targets: [
{
src: 'node_modules/jsbeeb/public/roms/**/*',
dest: 'roms',
globOptions: {
ignore: ['**/*.txt', '**/*README*'],
},
},
{
src: 'node_modules/jsbeeb/public/sounds/**/*.wav',
dest: 'sounds',
},
],
}),
],
assetsInclude: ['**/*.ttf', '**/*.rom'],
build: {
outDir: 'dist',
minify: true,
sourcemap: true,
chunkSizeWarningLimit: 5000,
rollupOptions: {
external: ['electron'],
output: {
manualChunks: {
vendor: ['jquery', 'underscore'],
monaco: ['monaco-editor'],
jsbeeb: ['jsbeeb'],
}
}
}
},
server: {
port: 8080,
},
css: {
devSourcemap: true,
preprocessorOptions: {
less: {
javascriptEnabled: true,
},
},
},
});