-
-
Notifications
You must be signed in to change notification settings - Fork 434
/
vite.config.ts
167 lines (157 loc) · 4.03 KB
/
vite.config.ts
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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
/// <reference types="vitest" />
import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue2'
import { VitePWA } from 'vite-plugin-pwa'
import Components from 'unplugin-vue-components/vite'
import { VuetifyResolver } from 'unplugin-vue-components/resolvers'
import path from 'path'
import content from '@originjs/vite-plugin-content'
import monacoEditorPluginModule from 'vite-plugin-monaco-editor'
import checker from 'vite-plugin-checker'
import version from './vite.config.inject-version'
// Fix for incorrect typings on vite-plugin-monaco-editor
const isObjectWithDefaultFunction = (module: unknown): module is { default: typeof monacoEditorPluginModule } => (
module != null &&
typeof module === 'object' &&
'default' in module &&
typeof module.default === 'function'
)
const monacoEditorPlugin = isObjectWithDefaultFunction(monacoEditorPluginModule)
? monacoEditorPluginModule.default
: monacoEditorPluginModule
export default defineConfig({
plugins: [
VitePWA({
srcDir: 'src',
filename: 'sw.ts',
strategies: 'injectManifest',
includeAssets: [
'**/*.svg',
'**/*.png',
'**/*.ico',
'editor.theme.json'
],
injectManifest: {
globPatterns: [
'**/*.{js,css,html,ttf,woff,woff2,wasm}'
],
maximumFileSizeToCacheInBytes: 4 * 1024 ** 2
},
manifest: {
name: 'fluidd',
short_name: 'fluidd',
description: 'The Klipper web interface for managing your 3d printer',
theme_color: '#2196F3',
background_color: '#000000',
icons: [
{
src: 'img/icons/android-chrome-192x192.png',
sizes: '192x192',
type: 'image/png'
},
{
src: 'img/icons/android-chrome-512x512.png',
sizes: '512x512',
type: 'image/png'
},
{
src: 'img/icons/android-chrome-maskable-192x192.png',
sizes: '192x192',
type: 'image/png',
purpose: 'maskable'
},
{
src: 'img/icons/android-chrome-maskable-512x512.png',
sizes: '512x512',
type: 'image/png',
purpose: 'maskable'
}
],
shortcuts: [
{
name: 'Configuration',
url: '#/configure',
icons: [
{
src: 'img/icons/shortcut-configuration-96x96.png',
sizes: '96x96',
type: 'image/png'
}
]
},
{
name: 'Settings',
url: '#/settings',
icons: [
{
src: 'img/icons/shortcut-settings-96x96.png',
sizes: '96x96',
type: 'image/png'
}
]
}
]
},
devOptions: {
enabled: true,
type: 'module',
navigateFallback: 'index.html'
}
}),
vue(),
version(),
content(),
monacoEditorPlugin({
languageWorkers: ['editorWorkerService', 'json', 'css']
}),
checker({
vueTsc: {
tsconfigPath: path.resolve(__dirname, './tsconfig.app.json')
}
}),
Components({
dts: true,
dirs: [
'src/components/common',
'src/components/layout',
'src/components/ui'
],
resolvers: [
VuetifyResolver()
]
})
],
css: {
preprocessorOptions: {
css: { charset: false },
scss: {
additionalData: '@import "@/scss/variables";\n'
},
sass: {
additionalData: '@import "@/scss/variables.scss"\n'
}
}
},
envPrefix: 'VUE_',
resolve: {
alias: {
'@': path.resolve(__dirname, './src'),
path: 'path-browserify'
}
},
test: {
globals: true,
environment: 'jsdom',
setupFiles: [
'./tests/unit/setup.ts'
],
alias: [
{ find: /^vue$/, replacement: 'vue/dist/vue.runtime.common.js' }
]
},
base: './',
server: {
host: '0.0.0.0',
port: 8080
}
})