mirror of
https://github.com/Azgaar/Fantasy-Map-Generator.git
synced 2025-12-17 09:41:24 +01:00
refactor(es modules): set up aliases
This commit is contained in:
parent
7755d8b588
commit
9206f46c42
4 changed files with 27 additions and 18 deletions
|
|
@ -1,5 +1,4 @@
|
|||
import {prompt} from "/src/scripts/prompt";
|
||||
import {byId, store, stored} from "/src/utils/shorthands";
|
||||
import {stored, byId, store} from "utils/shorthands";
|
||||
import {layerIsOn} from "./utils";
|
||||
|
||||
export function initLayers() {
|
||||
|
|
@ -77,12 +76,14 @@ const defaultPresets = {
|
|||
};
|
||||
|
||||
function restoreCustomPresets() {
|
||||
const storedPresets = JSON.parse(stored("presets"));
|
||||
if (!storedPresets) {
|
||||
const storedPresentsRaw = stored("presets");
|
||||
if (!storedPresentsRaw) {
|
||||
presets = structuredClone(defaultPresets);
|
||||
return;
|
||||
}
|
||||
|
||||
const storedPresets = JSON.parse(storedPresentsRaw);
|
||||
|
||||
for (const preset in storedPresets) {
|
||||
if (presets[preset]) continue;
|
||||
byId("layersPreset").add(new Option(preset, preset));
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
import {byId} from "/src/utils/shorthands";
|
||||
import {byId} from "utils/shorthands";
|
||||
import {updatePresetInput} from "./init";
|
||||
|
||||
export function layerIsOn(toggleId: string) {
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@
|
|||
"noUnusedParameters": true,
|
||||
"noImplicitReturns": true,
|
||||
"skipLibCheck": true,
|
||||
"baseUrl": "."
|
||||
"baseUrl": "src"
|
||||
},
|
||||
"include": ["src"]
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,14 +1,22 @@
|
|||
// import {defineConfig} from "vite";
|
||||
// import {fileURLToPath} from "url";
|
||||
// import path from "path";
|
||||
import {defineConfig} from "vite";
|
||||
import {fileURLToPath} from "url";
|
||||
import path from "path";
|
||||
|
||||
// const pathName = path.dirname(fileURLToPath(import.meta.url));
|
||||
const pathName = path.dirname(fileURLToPath(import.meta.url));
|
||||
|
||||
// export default defineConfig({
|
||||
// // base: "/Fantasy-Map-Generator/",
|
||||
// resolve: {
|
||||
// alias: [
|
||||
// {find: "@", replacement: path.resolve(pathName, "./src")}
|
||||
// ]
|
||||
// }
|
||||
// });
|
||||
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: "utils", replacement: path.resolve(pathName, "./src/utils")}
|
||||
]
|
||||
}
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue