-
Notifications
You must be signed in to change notification settings - Fork 0
/
vite.config.js
91 lines (86 loc) · 2.19 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
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
87
88
89
90
91
import { defineConfig, loadEnv } from 'vite';
import { fileURLToPath, URL } from 'url';
import vue from '@vitejs/plugin-vue';
import VueI18nPlugin from '@intlify/unplugin-vue-i18n/vite';
import Pages from 'vite-plugin-pages';
import eslint from 'vite-plugin-eslint';
import svgLoader from 'vite-svg-loader';
import AutoImport from 'unplugin-auto-import/vite';
import federation from '@originjs/vite-plugin-federation';
import expose from './src/expose';
import sharedConfig from './src/sharedConfig';
export default ({ mode }) => {
const remote = loadEnv(mode, './env');
return defineConfig({
server: {
port: 8081,
//필요 시 Back단으로 뺼 것
proxy: {
'/apitest': {
target: 'https://www.juso.go.kr', // 원격 서버 주소
changeOrigin: true, // 주소 변경 허용
secure: true, // HTTPS 사용 여부에 따라 true 또는 false 설정
rewrite: path => path.replace(/^\/apitest/, ''), // API 경로 리라이트
},
},
},
envDir: './env',
build: {
target: 'esnext',
cssCodeSplit: false,
outDir: 'dist/cm',
},
resolve: {
alias: {
'@': fileURLToPath(new URL('src', import.meta.url)),
'~': fileURLToPath(new URL('public', import.meta.url)),
'vue-i18n': 'vue-i18n/dist/vue-i18n.esm-bundler.js',
},
},
plugins: [
vue(),
VueI18nPlugin({}),
AutoImport({
include: [
/\.[tj]sx?$/, // .ts, .tsx, .js, .jsx
/\.vue$/,
/\.vue\?vue/, // .vue
],
imports: [
// presets
'vue',
'vue-router',
'vue-i18n',
],
vueTemplate: false,
}),
svgLoader(),
// eslint(),
federation({
name: 'cm-app',
filename: 'cm.js',
exposes: expose,
remotes: {
// '@fila/cm': `${remote.VITE_REMOTE_CM}`,
hr: `${remote.VITE_REMOTE_HR}`,
fcm: `${remote.VITE_REMOTE_FCM}`,
srm: `${remote.VITE_REMOTE_SRM}`,
'crm-kr': `${remote.VITE_REMOTE_CRM_KR}`,
'scm-kr': `${remote.VITE_REMOTE_SCM_KR}`,
'pos-kr': `${remote.VITE_REMOTE_POS_KR}`,
},
shared: sharedConfig,
}),
Pages({
dirs: [
{ dir: 'src/views', baseRoute: '' },
{
dir: 'src/samples',
baseRoute: 'samples',
},
],
exclude: ['**/codebox/**'],
}),
],
});
};