Skip to content

Commit

Permalink
fixed OL globals (#40)
Browse files Browse the repository at this point in the history
  • Loading branch information
zdila authored Jul 5, 2024
1 parent f864ffd commit 8b0fa25
Showing 1 changed file with 13 additions and 8 deletions.
21 changes: 13 additions & 8 deletions vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ export default defineConfig({
"leaflet",
"react",
"react-dom",
"ol",
/^ol(\/.*)?/,
],
output: [
{
Expand All @@ -100,13 +100,18 @@ export default defineConfig({
assetFileNames: "[name].[ext]",

// Provide global variables to use in the UMD build for externalized deps
globals: {
"@maptiler/sdk": "maptilersdk",
"maplibre-gl": "maplibregl",
leaflet: "L",
react: "React",
"react-dom": "ReactDOM",
ol: "ol",
globals(name) {
const global = {
"@maptiler/sdk": "maptilersdk",
"maplibre-gl": "maplibregl",
leaflet: "L",
react: "React",
"react-dom": "ReactDOM",
}[name];

return (
global ?? (name.startsWith("ol") ? name.replace(/\//g, ".") : "")
);
},
},
],
Expand Down

0 comments on commit 8b0fa25

Please sign in to comment.