68 lines
1.6 KiB
TypeScript
68 lines
1.6 KiB
TypeScript
import { defineConfig } from "@farmfe/core";
|
|
import vue from "@vitejs/plugin-vue";
|
|
import vueJsx from "@vitejs/plugin-vue-jsx";
|
|
import qiankun from "vite-plugin-qiankun";
|
|
import path from "path";
|
|
import less from "@farmfe/js-plugin-less";
|
|
import yargsParser from "yargs-parser";
|
|
import Components from "unplugin-vue-components/vite";
|
|
import { AntDesignVueResolver } from "unplugin-vue-components/resolvers";
|
|
|
|
// const ENVS = {
|
|
// DEVELOPMENT: "development",
|
|
// PRODUCTION: "production",
|
|
// STAGING: "staging",
|
|
// TEST: "test",
|
|
// };
|
|
|
|
const argv = yargsParser(process.argv.slice(2));
|
|
const env = process.env.NODE_ENV;
|
|
console.log("argv", argv);
|
|
console.log("env", env);
|
|
|
|
// let base: string;
|
|
// switch (argv.mode) {
|
|
// case "staging":
|
|
// case "test":
|
|
// base = "https://custom-chart.shiyue.com/";
|
|
// break;
|
|
// case "production":
|
|
// base = "https://custom-chart.shiyuegame.com/";
|
|
// break;
|
|
// default:
|
|
// base = "http://localhost:8080/";
|
|
// }
|
|
// if (env === ENVS.DEVELOPMENT) base = "http://localhost:8080/";
|
|
|
|
// console.log("base", base);
|
|
|
|
export default defineConfig({
|
|
plugins: [less()],
|
|
vitePlugins: [
|
|
vue(),
|
|
vueJsx(),
|
|
qiankun("y-code-app", {
|
|
useDevMode: process.env.DEV_ENV === "development",
|
|
}) as any,
|
|
Components({
|
|
resolvers: [
|
|
AntDesignVueResolver({
|
|
importStyle: "less",
|
|
}),
|
|
],
|
|
}),
|
|
],
|
|
server: {
|
|
cors: true,
|
|
open: false,
|
|
port: 8080,
|
|
},
|
|
compilation: {
|
|
resolve: {
|
|
alias: {
|
|
"@": path.resolve(__dirname, "./src"),
|
|
},
|
|
},
|
|
},
|
|
});
|