diff --git a/src/layers/init.ts b/src/layers/init.ts index 5248f67d..b0027531 100644 --- a/src/layers/init.ts +++ b/src/layers/init.ts @@ -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)); diff --git a/src/layers/utils.ts b/src/layers/utils.ts index 2c658887..e1a612bf 100644 --- a/src/layers/utils.ts +++ b/src/layers/utils.ts @@ -1,4 +1,4 @@ -import {byId} from "/src/utils/shorthands"; +import {byId} from "utils/shorthands"; import {updatePresetInput} from "./init"; export function layerIsOn(toggleId: string) { diff --git a/tsconfig.json b/tsconfig.json index 86d8eed7..3adf2c27 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -15,7 +15,7 @@ "noUnusedParameters": true, "noImplicitReturns": true, "skipLibCheck": true, - "baseUrl": "." + "baseUrl": "src" }, "include": ["src"] } diff --git a/vite.config.js b/vite.config.js index 7033e2e7..fd2da414 100644 --- a/vite.config.js +++ b/vite.config.js @@ -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")} + ] + } +});