-
Notifications
You must be signed in to change notification settings - Fork 1
/
vite.config.local.js
102 lines (98 loc) · 2.93 KB
/
vite.config.local.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
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
import { defineConfig, loadEnv } from "vite";
import dynamicImport from 'vite-plugin-dynamic-import'
import eslintPlugin from "@nabla/vite-plugin-eslint";
import legacy from '@vitejs/plugin-legacy';
import { viteStaticCopy } from 'vite-plugin-static-copy';
import vue from '@vitejs/plugin-vue'
import stylelint from 'vite-plugin-stylelint';
import path from 'path';
import mkcert from 'vite-plugin-mkcert';
// https://vitejs.dev/config/
export default defineConfig(({ command, mode }) => {
const env = loadEnv(mode, process.cwd(), '');
let plugins = [
dynamicImport(),
legacy({
targets: ['defaults', 'not IE 11']
}),
mkcert(),
stylelint({
fix: true,
}),
eslintPlugin({
cache: false,
fix: true,
}),
viteStaticCopy({
targets: [
{
src: 'src/static',
dest: ''
}
]
}),
vue(),
];
return {
base: command === 'serve' ? '' : '/dist/',
build: {
emptyOutDir: true,
manifest: true,
outDir: './web/dist/',
rollupOptions: {
input: {
app: './src/scripts/main.js',
},
output: {
/*
Optionally, manually separate out a vendor chunk containing
modules imported by lots of your components
*/
manualChunks: (id) => {
if (id.includes("node_modules")) {
if (id.includes('alpine')
|| id.includes('lazysizes')
|| id.includes('pubsub-js')
|| id.includes('vue')
) {
return "vendor";
}
}
},
}
},
},
plugins: plugins,
resolve: {
alias: {
'@': path.resolve(__dirname, 'src'),
'@css': path.resolve(__dirname, 'src/styles'),
'@js': path.resolve(__dirname, 'src/scripts'),
},
},
server: {
fs: {
strict: true
},
origin: 'https://localhost:3000',
port: 3000,
strictPort: true,
watch: {
ignored: [
"**/storage/**",
"**/web/**",
"**/vendor/**",
`${__dirname}/.idea/**`,
`${__dirname}/.stylelintcache/**`
],
},
},
css: {
preprocessorOptions: {
scss: {
api: 'modern-compiler' // or "modern"
}
}
}
}
});