정리
This commit is contained in:
+19
-4
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user