-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvite.config.js
38 lines (38 loc) · 946 Bytes
/
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
import { defineConfig } from 'vite'
import { createVuePlugin } from "vite-plugin-vue2";
import vueJsx from '@vitejs/plugin-vue-jsx'
import path from 'path'
import mockServer from './mock/mock-server.js';
// https://vitejs.dev/config/
export default defineConfig({
plugins: [
createVuePlugin(),
vueJsx(),
{
name: 'load-vue-files-as-jsx',
async transform(code, id) {
if (!id.endsWith('.vue')) return null
return code
},
enforce: 'pre',
}
],
server: {
proxy: {
'/vue-element-admin': {
target: 'http://127.0.0.1:5678',
changeOrigin: true,
rewrite: (path) => path.replace(/^\/vue-element-admin/, '/dev-api/vue-element-admin')
},
},
},
define: {
'process.env.BASE_ENV': JSON.stringify(process.env.BASE_ENV)
},
resolve: {
alias: {
'@': path.resolve(__dirname, './src')
},
extensions: [".vue", ".js", ".json"],
}
})