From c5c56409ee82508d349650a0dbf58562b3d8d145 Mon Sep 17 00:00:00 2001 From: Brandon Liu Date: Sat, 16 Nov 2024 17:13:04 +0800 Subject: [PATCH] avoid dynamic import --- app/src/App.tsx | 9 +++++---- themes/bright.ts | 2 ++ themes/contrast.ts | 2 ++ 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/app/src/App.tsx b/app/src/App.tsx index 0a605fc..6c28536 100644 --- a/app/src/App.tsx +++ b/app/src/App.tsx @@ -9,10 +9,11 @@ const THEMES = ["contrast", "bright"]; const themeToLayers = new Map(); -for (let themeName of THEMES) { - let theme = await import(`../../themes/${themeName}.ts`); - themeToLayers.set(themeName, theme.default); -} +import contrast from "../../themes/contrast.ts"; +themeToLayers.set("contrast", contrast); + +import bright from "../../themes/bright.ts"; +themeToLayers.set("bright", bright); const getStyle = (index: number):StyleSpecification => { let themeName = THEMES[index]; diff --git a/themes/bright.ts b/themes/bright.ts index b1ee159..e1cda36 100644 --- a/themes/bright.ts +++ b/themes/bright.ts @@ -1,3 +1,5 @@ +import { Theme } from "protomaps-themes-base"; + export default { background: "rgba(255, 255, 255, 1)", earth: "rgba(226, 222, 235, 1)", diff --git a/themes/contrast.ts b/themes/contrast.ts index 6fd7e3b..2fe5638 100644 --- a/themes/contrast.ts +++ b/themes/contrast.ts @@ -1,3 +1,5 @@ +import { Theme } from "protomaps-themes-base"; + export default { background: "#dddddd", earth: "#ededed",