forked from wanglin2/code-run
-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathvite.config.js
More file actions
86 lines (85 loc) · 2.28 KB
/
Copy pathvite.config.js
File metadata and controls
86 lines (85 loc) · 2.28 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
85
86
import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import { VitePWA } from 'vite-plugin-pwa'
import path from 'path'
export default defineConfig({
base: './',
publicDir: 'public',
plugins: [
vue(),
VitePWA({
strategies: 'injectManifest',
srcDir: 'src',
filename: 'service-worker.js',
integration: {
configureCustomSWViteBuild(swBuildConfig) {
const output = swBuildConfig.build?.rollupOptions?.output
if (output && !Array.isArray(output)) {
delete output.inlineDynamicImports
output.codeSplitting = false
}
}
},
injectManifest: {
maximumFileSizeToCacheInBytes: 12 * 1024 * 1024,
globIgnores: ['**/*.map', 'manifest*.js', 'CNAME', '.nojekyll']
},
injectRegister: false
})
],
resolve: {
alias: {
'@': path.resolve(__dirname, './src'),
path: path.resolve(__dirname, './src/shims/path.js')
},
extensions: ['.mjs', '.js', '.ts', '.jsx', '.tsx', '.json', '.vue']
},
server: {
host: '0.0.0.0',
port: 8080
},
build: {
outDir: 'docs',
emptyOutDir: true,
sourcemap: false,
chunkSizeWarningLimit: 2800,
rolldownOptions: {
checks: {
invalidAnnotation: false
},
output: {
codeSplitting: {
minSize: 20 * 1024,
groups: [
{
name: 'vendor-vue',
test: /node_modules[\\/](vue|vue-router|vuex)[\\/]/,
priority: 50
},
{
name: 'vendor-element-plus',
test: /node_modules[\\/](@element-plus|element-plus)[\\/]/,
priority: 45
},
{
name: 'vendor-monaco',
test: /node_modules[\\/](monaco-editor|monaco-editor-textmate|monaco-textmate|onigasm|dompurify|marked)[\\/]/,
priority: 40
},
{
name: 'vendor-export',
test: /node_modules[\\/](html2canvas|cropperjs|jszip|fflate|sharp)[\\/]/,
priority: 35
},
{
name: 'vendor-utils',
test: /node_modules[\\/]/,
priority: 10,
maxSize: 1200 * 1024
}
]
}
}
}
}
})