mirror of
https://github.com/Azgaar/Fantasy-Map-Generator.git
synced 2025-12-17 17:51:24 +01:00
refactor: define globals
This commit is contained in:
parent
22903fcb71
commit
7c2c624417
26 changed files with 939 additions and 245 deletions
|
|
@ -1,23 +1,42 @@
|
|||
import {defineConfig} from "vite";
|
||||
import {createHtmlPlugin} from "vite-plugin-html";
|
||||
import {fileURLToPath} from "url";
|
||||
import path from "path";
|
||||
|
||||
const pathName = path.dirname(fileURLToPath(import.meta.url));
|
||||
|
||||
export default defineConfig({
|
||||
base: "/Fantasy-Map-Generator/",
|
||||
resolve: {
|
||||
alias: [
|
||||
{find: "src", replacement: path.resolve(pathName, "./src")},
|
||||
{find: "components", replacement: path.resolve(pathName, "./src/components")},
|
||||
{find: "config", replacement: path.resolve(pathName, "./src/config")},
|
||||
{find: "constants", replacement: path.resolve(pathName, "./src/constants")},
|
||||
{find: "layers", replacement: path.resolve(pathName, "./src/layers")},
|
||||
{find: "libs", replacement: path.resolve(pathName, "./src/libs")},
|
||||
{find: "modules", replacement: path.resolve(pathName, "./src/modules")},
|
||||
{find: "modules", replacement: path.resolve(pathName, "./src/modules")},
|
||||
{find: "scripts", replacement: path.resolve(pathName, "./src/scripts")},
|
||||
{find: "utils", replacement: path.resolve(pathName, "./src/utils")}
|
||||
]
|
||||
}
|
||||
export default defineConfig(({mode}) => {
|
||||
const APP_VERSION = JSON.stringify(process.env.npm_package_version);
|
||||
const PRODUCTION = mode === "production";
|
||||
|
||||
return {
|
||||
base: "/Fantasy-Map-Generator/",
|
||||
define: {
|
||||
APP_VERSION,
|
||||
PRODUCTION
|
||||
},
|
||||
plugins: [
|
||||
createHtmlPlugin({
|
||||
inject: {
|
||||
data: {
|
||||
APP_VERSION: APP_VERSION.replaceAll('"', "")
|
||||
}
|
||||
}
|
||||
})
|
||||
],
|
||||
resolve: {
|
||||
alias: [
|
||||
{find: "src", replacement: path.resolve(pathName, "./src")},
|
||||
{find: "components", replacement: path.resolve(pathName, "./src/components")},
|
||||
{find: "config", replacement: path.resolve(pathName, "./src/config")},
|
||||
{find: "constants", replacement: path.resolve(pathName, "./src/constants")},
|
||||
{find: "layers", replacement: path.resolve(pathName, "./src/layers")},
|
||||
{find: "libs", replacement: path.resolve(pathName, "./src/libs")},
|
||||
{find: "modules", replacement: path.resolve(pathName, "./src/modules")},
|
||||
{find: "modules", replacement: path.resolve(pathName, "./src/modules")},
|
||||
{find: "scripts", replacement: path.resolve(pathName, "./src/scripts")},
|
||||
{find: "utils", replacement: path.resolve(pathName, "./src/utils")}
|
||||
]
|
||||
}
|
||||
};
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue