-
-
Notifications
You must be signed in to change notification settings - Fork 20
/
vite.config.js
62 lines (60 loc) · 1.63 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
import { resolve } from 'node:path';
import { fileURLToPath } from 'node:url';
import { defineConfig } from 'vite';
import legacy from '@vitejs/plugin-legacy';
import handlebars from 'vite-plugin-handlebars';
import { VitePWA as pwa } from 'vite-plugin-pwa';
import { ViteWebfontDownload as webfont } from 'vite-plugin-webfont-dl';
const __dirname = fileURLToPath(new URL('.', import.meta.url));
export default defineConfig({
build: {
minify: false,
rollupOptions: {
input: {
viewer: resolve(__dirname, 'index.html'),
editor: resolve(__dirname, 'editor.html'),
settings: resolve(__dirname, 'settings.html'),
},
},
},
plugins: [
handlebars({
partialDirectory: resolve(__dirname, 'partials'),
helpers: {
activeIf(context, name) {
if (context === name) {
return ' navbar__link--active';
} else {
return '';
}
},
},
}),
webfont(
'https://fonts.googleapis.com/css2?family=Lato:wght@400;900&display=swap',
),
pwa({
manifest: false,
workbox: {
cacheId: 'maskable.app',
globPatterns: [
'*.{html,css,svg,woff2}',
'assets/*.js',
'demo/*.{png,svg}',
'favicon/favicon_*.png',
'toggle/*.svg',
],
globIgnores: ['assets/*-legacy.*.js', 'open'],
ignoreURLParametersMatching: [/demo/, /fbclid/],
},
}),
legacy({
targets: ['defaults', 'not IE 11', 'kaios >= 2'],
}),
],
test: {
environment: 'jsdom',
include: ['tests/**/*.spec.ts'],
exclude: ['tests/e2e/**/*'],
},
});