-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvite.config.ts
More file actions
77 lines (74 loc) · 1.99 KB
/
vite.config.ts
File metadata and controls
77 lines (74 loc) · 1.99 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
import { defineConfig, loadEnv } from 'vite'
import { createVuePlugin } from 'vite-plugin-vue2'
import eslintPlugin from 'vite-plugin-eslint'
import envCompatible from 'vite-plugin-env-compatible'
import Components from 'unplugin-vue-components/vite'
import { VuetifyResolver } from 'unplugin-vue-components/resolvers'
import path from 'path'
const proxyToProd = {
'/api': 'https://pyshare.noj.tw',
'/socket.io': 'https://pyshare.noj.tw/notifier',
}
// https://vitejs.dev/config/
export default ({ mode }) => {
process.env = { ...process.env, ...loadEnv(mode, process.cwd()) }
return defineConfig({
base: '/',
resolve: {
alias: [
{
find: '@/',
replacement: `${path.resolve(__dirname, './src')}/`,
},
{
find: 'src/',
replacement: `${path.resolve(__dirname, './src')}/`,
},
],
},
server: {
proxy: process.env.VITE_APP_USE_PROXY === 'true' ? proxyToProd : null,
host: '0.0.0.0',
port: 8080,
},
plugins: [
// Vue2
createVuePlugin({
target: 'esnext',
}),
// Vuetify
Components({
// relative paths to the directory to search for components.
dirs: ['src/components'],
// generate `components.d.ts` global declarations
dts: true,
// auto import for directives
directives: false,
// resolvers for custom components
resolvers: [VuetifyResolver()],
}),
// eslint
eslintPlugin(),
// fix .env file
envCompatible(),
],
css: {
// https://vitejs.dev/config/#css-preprocessoroptions
preprocessorOptions: {
sass: {
additionalData: [
// vuetify variable overrides
'@import "@/sass/variables.scss"',
'@import "@/sass/styles.scss"',
'',
].join('\n'),
},
},
},
// Build Options
// https://vitejs.dev/config/#build-options
build: {
target: 'es2021',
},
})
}