-
-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathvite.config.app.ts
49 lines (47 loc) · 1.23 KB
/
vite.config.app.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
import { fileURLToPath, URL } from 'url';
import { defineConfig } from 'vite';
import vue from '@vitejs/plugin-vue';
import svgLoader from 'vite-svg-loader';
import { dependencies } from './package.json';
import EnvironmentPlugin from 'vite-plugin-environment';
const renderChunks = (deps: Record<string, string>) => {
const chunks: Record<string, Array<string>> = {};
Object.keys(deps).forEach((key) => {
if (['vue', 'vue-router'].includes(key)) return;
chunks[key] = [key];
});
return chunks;
};
export default defineConfig({
plugins: [vue(), svgLoader({ defaultImport: 'raw' }), EnvironmentPlugin('all')],
base: '/neon/',
server: {
host: '0.0.0.0',
port: 8081,
base: '/neon/',
},
resolve: {
alias: {
'@': fileURLToPath(new URL('./src', import.meta.url)),
vue$: 'vue/dist/vue.esm-bundler.js',
},
},
build: {
emptyOutDir: true,
rollupOptions: {
output: {
manualChunks: {
vendor: ['vue', 'vue-router'],
...renderChunks(dependencies),
},
entryFileNames: ({ name: fileName }) => {
return `${fileName}.js`;
},
globals: {
vue: 'Vue',
'vue-router': 'VueRouter',
},
},
},
},
});