-
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathvite.config.js
53 lines (49 loc) · 1.37 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
import { fileURLToPath, URL } from 'node:url'
import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import * as path from "path";
// https://vitejs.dev/config/
export default defineConfig(({ command, mode, isSsrBuild, isPreview}) => {
const build = {
bourcemap: true,
checkSizeWarningLimit: 10000,
modulePreload: {
resolveDependencies: (url, deps, context) => {
return [];
}
},
rollupOptions: {
output: {
manualChunks(id) {
// To see what modules are big, look at the sizes using:
// if (id.includes("node_modules")) return id.toString().split("node_modules/")[1].split("/")[0].toString();
const bigBois = [ "@phosphor-icons" ];
if (bigBois.some(n => id.includes(`node_modules/${n}`))) return id.toString().split("node_modules/")[1].split("/")[0].toString();
},
}
}
};
const plugins = [
vue() // Vue plugin
];
const resolve = {
alias: {
'@': fileURLToPath(new URL('./src', import.meta.url)),
'vue/server-renderer': path.resolve(__dirname, 'node_modules', '@vue', 'server-renderer', 'dist', 'server-renderer.esm-bundler.js'),
'vue': path.resolve(__dirname, 'node_modules', 'vue', 'dist', 'vue.esm-bundler.js'),
}
};
return {
css: {
preprocessorOptions: {
sass: {
api: 'modern-compiler' // or "modern"
}
}
},
build,
plugins,
resolve,
ssr: ["build"].includes(command)
};
})