-
Notifications
You must be signed in to change notification settings - Fork 42
Expand file tree
/
Copy pathvite.config.js
More file actions
84 lines (78 loc) · 2.48 KB
/
vite.config.js
File metadata and controls
84 lines (78 loc) · 2.48 KB
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
import { dirname, resolve } from 'node:path';
import { fileURLToPath, URL } from 'node:url';
import { defineConfig, loadEnv } from 'vite';
import vue from '@vitejs/plugin-vue';
import vueDevTools from 'vite-plugin-vue-devtools';
import Vuetify from 'vite-plugin-vuetify';
import eslintPlugin from '@nabla/vite-plugin-eslint';
import mdiWoff2OnlyPlugin from './plugins/vite-plugin-mdi-woff2';
// https://vite.dev/config/
export default defineConfig(({ mode }) => {
const __dirname = dirname(fileURLToPath(import.meta.url));
const env = loadEnv(mode, process.cwd(), '');
return {
// Compile-time flags recommended to always be configured following Vite documentation.
// See https://vuejs.org/api/compile-time-flags#compile-time-flags
define: {
__VUE_OPTIONS_API__: 'true',
__VUE_PROD_DEVTOOLS__: 'false',
__VUE_PROD_HYDRATION_MISMATCH_DETAILS__: 'false'
},
plugins: [
// Enable Vue compatibility build in Vue3 mode.
// See https://v3-migration.vuejs.org/migration-build.html#compiler-specific-config
vue({
template: {
compilerOptions: {
compatConfig: {
MODE: 3
}
}
}
}),
// Remove Vue DevTools plugin when building for unit tests.
...(process.env.NODE_ENV === 'test' ? [] : [vueDevTools()]),
Vuetify({
styles: {
configFile: 'app/styles/vuetify-settings.scss'
}
}),
eslintPlugin({
// Lint src and app directories.
shouldLint: (path) => path.match(/\/(src|app)\/[^?]*\.(vue|svelte|m?[jt]sx?)$/)
}),
mdiWoff2OnlyPlugin()
],
// Needed so vite-plugin-vuetify can process source code correctly.
optimizeDeps: {
exclude: [
'vuetify'
]
},
resolve: {
alias: {
'@': fileURLToPath(new URL('./src', import.meta.url)),
APP: fileURLToPath(new URL('./app', import.meta.url)),
// Ensure Vue compatibility build is used when importing Vue.
vue: '@vue/compat'
}
},
// Apply the default deployment path if not specified or if running unit tests.
base: (process.env.NODE_ENV !== 'test' && env?.WGU_PUBLIC_PATH) || './',
publicDir: 'app/public',
server: {
open: '/index.html'
},
preview: {
open: '/index.html'
},
build: {
rollupOptions: {
input: {
main: resolve(__dirname, 'index.html'),
embedded: resolve(__dirname, 'embedded.html')
}
}
}
};
});