fix: 新增配置qiankun
This commit is contained in:
@@ -4,10 +4,41 @@ import vue from '@vitejs/plugin-vue';
|
||||
import vueJsx from '@vitejs/plugin-vue-jsx';
|
||||
import Components from 'unplugin-vue-components/vite';
|
||||
import { AntDesignVueResolver } from 'unplugin-vue-components/resolvers';
|
||||
import { server } from 'typescript';
|
||||
import qiankun from 'vite-plugin-qiankun'
|
||||
import yargsParser from 'yargs-parser'
|
||||
|
||||
const argv = yargsParser(process.argv.slice(2))
|
||||
|
||||
console.log(process.env.DEV_ENV)
|
||||
|
||||
let base: string
|
||||
switch (argv.mode) {
|
||||
case 'staging':
|
||||
case 'test':
|
||||
base = 'https://custom-chart-pre-api.shiyue.com/'
|
||||
break
|
||||
case 'production':
|
||||
base = 'https://custom-chart-api.shiyuegame.com/'
|
||||
break
|
||||
default:
|
||||
base = 'http://localhost:8080/'
|
||||
}
|
||||
if (process.env.DEV_ENV === 'development') {
|
||||
base = 'http://localhost:8080/'
|
||||
}
|
||||
|
||||
// https://vitejs.dev/config/
|
||||
export default defineConfig({
|
||||
build: {
|
||||
sourcemap: false,
|
||||
rollupOptions: {
|
||||
output: {
|
||||
assetFileNames: '[name]-ycode-[hash:8].[ext]',
|
||||
chunkFileNames: '[name]-ycode-[hash:8].js',
|
||||
entryFileNames: '[name]-ycode-[hash:8].js',
|
||||
},
|
||||
},
|
||||
},
|
||||
plugins: [
|
||||
vue(),
|
||||
vueJsx(),
|
||||
@@ -16,14 +47,20 @@ export default defineConfig({
|
||||
importStyle: 'less',
|
||||
})],
|
||||
}),
|
||||
qiankun('y-code-app', { useDevMode: process.env.DEV_ENV === 'development' }),
|
||||
],
|
||||
resolve: {
|
||||
alias: {
|
||||
'@': fileURLToPath(new URL('./src', import.meta.url)),
|
||||
},
|
||||
},
|
||||
base,
|
||||
define: {
|
||||
_BASE_HOST_: `'${base}'`,
|
||||
},
|
||||
server: {
|
||||
hmr: true,
|
||||
host: '0.0.0.0',
|
||||
port: 8080,
|
||||
},
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user