forked from klembot/twinejs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
vite.config.mts
60 lines (59 loc) · 1.45 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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
import react from '@vitejs/plugin-react-swc';
import browserslistToEsbuild from 'browserslist-to-esbuild';
import {defineConfig} from 'vite';
import checker from 'vite-plugin-checker';
import {nodePolyfills} from 'vite-plugin-node-polyfills';
import {VitePWA} from 'vite-plugin-pwa';
import packageJson from './package.json';
export default defineConfig({
base: './',
build: {
outDir: 'dist/web',
target: browserslistToEsbuild(['>0.2%', 'not dead', 'not op_mini all'])
},
define: {
// Make app name and version available to code.
// https://stackoverflow.com/a/74860417/7569568
'process.env.VITE_APP_NAME': JSON.stringify(packageJson.name),
'process.env.VITE_APP_VERSION': JSON.stringify(packageJson.version)
},
plugins: [
checker({
eslint: {lintCommand: 'eslint src'},
overlay: {
initialIsOpen: false
},
typescript: true
}),
nodePolyfills(
// We only need a `global` injected, for CodeMirror.
{include: [], globals: {global: true}}
),
react(),
VitePWA({
manifest: {
icons: [
{
src: './icons/pwa.png',
sizes: '1024x1024',
type: 'image/png'
},
{
src: './icons/pwa-maskable.png',
purpose: 'maskable',
sizes: '1024x1024',
type: 'image/png'
}
]
},
registerType: 'autoUpdate',
includeAssets: ['locales/**', 'pwa/**', 'story-formats/**'],
workbox: {
globPatterns: ['**/*.{js,css,html,svg,woff,woff2}']
}
})
],
server: {
open: true
}
});