Skip to content

Commit d28ac1f

Browse files
authored
Add troubleshooting steps for CRA and geo components (#2511)
1 parent 8350d36 commit d28ac1f

File tree

1 file changed

+33
-0
lines changed

1 file changed

+33
-0
lines changed

docs/src/pages/[platform]/getting-started/troubleshooting/troubleshooting.react.mdx

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,39 @@ export default defineConfig({
8989
...
9090
```
9191
92+
## Create React App
93+
94+
When using [Geo components](../../connected-components/geo) and Create React App v5, users may experience the following error when rendering the `<MapView>` component in a production build:
95+
```bash
96+
Uncaught ReferenceError: g is not defined
97+
```
98+
The error is related to this [maplibre-gl issue](https://github.com/maplibre/maplibre-gl-js/issues/1011#issuecomment-1073112585) and surfaces due to the dropped support for Internet Explorer in `maplibre-gl` v2. To correct this error, you'll need to adjust your browser target for production to exclude Internet Explorer:
99+
100+
**1.** In your `package.json` file of your Create React App, adjust the `browserslist.production` block from:
101+
```json
102+
"browserslist": {
103+
"production": [
104+
">0.2%",
105+
"not dead",
106+
"not op_mini all"
107+
],
108+
...
109+
}
110+
```
111+
to the following:
112+
```json
113+
"browserslist": {
114+
"production": [
115+
"defaults",
116+
"not ie 11"
117+
],
118+
...
119+
}
120+
```
121+
**2.** Rebuild your production application using `npx run build`.
122+
123+
**3.** Run your production build using a tool like [serve](https://www.npmjs.com/package/serve) (`serve -s build`) and verify the `<MapView>` component renders without error.
124+
92125
## Jest
93126
94127
As of v2.15.0 of `@aws-amplify/ui-react` which included the release of Geo components, users of the Jest testing framework may run into the following error when attempting to run tests:

0 commit comments

Comments
 (0)