This commit is contained in:
2022-07-09 20:45:37 +09:00
parent 6db5476987
commit 9afd163e7d
7 changed files with 19 additions and 89 deletions
+19 -4
View File
@@ -2,14 +2,22 @@ import { defineConfig, UserConfigExport } from "vite";
import vue from "@vitejs/plugin-vue";
import { resolve } from "node:path";
import { map } from "lodash";
import { existsSync, readFileSync } from "node:fs";
import { existsSync, fstat, readFileSync } from "node:fs";
type ExportKey = "ingame" | "ingame_vue";
type BuildExports = Record<ExportKey, Record<string, string>>;
// https://vitejs.dev/config/
export default defineConfig(({ command, mode }) => {
const target = "hwe"; //방법이 있나?
export default defineConfig(({ mode }) => {
const target = (()=>{
if(mode === "production" || mode === 'development'){
return "hwe";
}
if(existsSync(mode)){
return mode;
}
throw `invalid mode: ${mode}`;
})();
const tsDir = resolve(__dirname, `${target}/ts/`);
const build_exports: BuildExports = require(`${tsDir}/build_exports.json`);
@@ -51,11 +59,18 @@ export default defineConfig(({ command, mode }) => {
resolve: {
alias: {
"@": tsDir,
"@scss": resolve(__dirname, `${target}/scss/`),
"@scss": `${target}/scss/`,
"@util": resolve(tsDir, `util`),
},
},
plugins: [vue()],
optimizeDeps: {
include: ['esm-dep > cjs-dep']
},
publicDir: false,
server: {
middlewareMode: "html",
}
};
return config;