-
Notifications
You must be signed in to change notification settings - Fork 2
/
vite.config.mts
46 lines (45 loc) · 1.16 KB
/
vite.config.mts
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
import path from 'path'
import { createRequire } from 'node:module'
import { defineConfig } from 'vite'
import { viteStaticCopy } from 'vite-plugin-static-copy'
import { nodePolyfills } from 'vite-plugin-node-polyfills'
import { VitePWA } from 'vite-plugin-pwa'
export default defineConfig({
base: process.env.NODE_ENV === 'production' ? '/simu-dos/' : '/',
define: {
'import.meta.env.BUILD': Date.now(),
},
server: {
host: '0.0.0.0',
},
assetsInclude: [
'**/*.zip',
],
resolve: {
alias: {
'@': path.resolve(__dirname, 'app'),
}
},
plugins: [
nodePolyfills({
globals: {
process: true,
}
}),
viteStaticCopy({
targets: Array.from(function*() {
const require = createRequire(import.meta.url)
const root = path.dirname(require.resolve('js-dos/package.json'))
const jsdos = path.join(root, 'dist')
const files = ['wdosbox.js', 'wdosbox.js.symbols', 'wdosbox.wasm.js']
for (const file of files) {
const src = path.join(jsdos, file)
yield { src, dest: './' }
}
}())
}),
VitePWA({
registerType: 'autoUpdate',
}),
]
})