Skip to content

Commit

Permalink
avoid dynamic import
Browse files Browse the repository at this point in the history
  • Loading branch information
bdon committed Nov 16, 2024
1 parent f83ce1e commit c5c5640
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 4 deletions.
9 changes: 5 additions & 4 deletions app/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,11 @@ const THEMES = ["contrast", "bright"];

const themeToLayers = new Map<string, Theme>();

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];
Expand Down
2 changes: 2 additions & 0 deletions themes/bright.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { Theme } from "protomaps-themes-base";

export default <Theme> {
background: "rgba(255, 255, 255, 1)",
earth: "rgba(226, 222, 235, 1)",
Expand Down
2 changes: 2 additions & 0 deletions themes/contrast.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { Theme } from "protomaps-themes-base";

export default <Theme> {
background: "#dddddd",
earth: "#ededed",
Expand Down

0 comments on commit c5c5640

Please sign in to comment.