-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvite.config.js
More file actions
63 lines (58 loc) · 2.07 KB
/
vite.config.js
File metadata and controls
63 lines (58 loc) · 2.07 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
import { fileURLToPath, URL } from 'node:url'
import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import vueDevTools from 'vite-plugin-vue-devtools'
// element plus
import AutoImport from 'unplugin-auto-import/vite'
import Components from 'unplugin-vue-components/vite'
import { ElementPlusResolver } from 'unplugin-vue-components/resolvers'
import { viteSingleFile } from 'vite-plugin-singlefile'
import { nodePolyfills } from 'vite-plugin-node-polyfills'
// https://vite.dev/config/
export default defineConfig({
plugins: [
vue(),
vueDevTools(),
viteSingleFile(),
nodePolyfills({
// To exclude specific polyfills, add them to this list.
exclude: ['fs'],
// Whether to polyfill `global`.
global: true,
// Whether to polyfill `process`.
process: true,
// Whether to polyfill `Buffer`.
buffer: true,
// Additional modules that should be polyfilled.
protocolImports: true,
}),
AutoImport({
resolvers: [ElementPlusResolver()],
}),
Components({
resolvers: [ElementPlusResolver()],
})
],
resolve: {
alias: [
{ find: 'vue-i18n', replacement: 'vue-i18n/dist/vue-i18n.esm-bundler.js' },
{ find: 'sqlite3', replacement: fileURLToPath(new URL('./src/mock-sqlite.js', import.meta.url)) },
{ find: /^fs(\/promises)?$/, replacement: fileURLToPath(new URL('./src/mock-fs.js', import.meta.url)) },
{ find: '@', replacement: fileURLToPath(new URL('./src', import.meta.url)) },
],
},
build: {
outDir: 'dist',
rollupOptions: {
onwarn(warning, defaultHandler) {
if (warning.code === 'EVAL') return;
defaultHandler(warning);
}
}
},
define: {
__VUE_I18N_FULL_INSTALL__: JSON.stringify(true),
__VUE_I18N_LEGACY_API__: JSON.stringify(false),
__INTLIFY_PROD_DEVTOOLS__: JSON.stringify(false)
}
})