Skip to content

Commit 9d1f5ff

Browse files
committed
Fix mapbox RTL (fix #1391)
1 parent 563fa20 commit 9d1f5ff

File tree

4 files changed

+235
-5
lines changed

4 files changed

+235
-5
lines changed

package-lock.json

Lines changed: 226 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@
6565
"eslint-plugin-jsx-a11y": "^6.10.2",
6666
"eslint-plugin-react": "^7.37.5",
6767
"eslint-plugin-react-hooks": "^5.2.0",
68-
"globals": "^16.2.0"
68+
"globals": "^16.2.0",
69+
"vite-plugin-static-copy": "^3.0.0"
6970
}
7071
}

src/map/core/MapView.jsx

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -86,9 +86,7 @@ const MapView = ({ children }) => {
8686

8787
useEffectAsync(async () => {
8888
if (theme.direction === 'rtl') {
89-
// eslint-disable-next-line import/no-unresolved
90-
const module = await import('@mapbox/mapbox-gl-rtl-text/mapbox-gl-rtl-text.min?url');
91-
maplibregl.setRTLTextPlugin(module.default);
89+
maplibregl.setRTLTextPlugin('/mapbox-gl-rtl-text.js');
9290
}
9391
}, [theme.direction]);
9492

vite.config.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import { defineConfig } from 'vite';
22
import react from '@vitejs/plugin-react';
33
import svgr from 'vite-plugin-svgr';
44
import { VitePWA } from 'vite-plugin-pwa';
5+
import { viteStaticCopy } from 'vite-plugin-static-copy';
56

67
export default defineConfig(() => ({
78
server: {
@@ -48,5 +49,10 @@ export default defineConfig(() => ({
4849
],
4950
},
5051
}),
52+
viteStaticCopy({
53+
targets: [
54+
{ src: 'node_modules/@mapbox/mapbox-gl-rtl-text/dist/mapbox-gl-rtl-text.js', dest: '' },
55+
],
56+
}),
5157
],
5258
}));

0 commit comments

Comments
 (0)