Skip to content

Commit

Permalink
Add troubleshooting steps for CRA and geo components (#2511)
Browse files Browse the repository at this point in the history
  • Loading branch information
slaymance authored Aug 24, 2022
1 parent 8350d36 commit d28ac1f
Showing 1 changed file with 33 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,39 @@ export default defineConfig({
...
```
## Create React App
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:
```bash
Uncaught ReferenceError: g is not defined
```
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:
**1.** In your `package.json` file of your Create React App, adjust the `browserslist.production` block from:
```json
"browserslist": {
"production": [
">0.2%",
"not dead",
"not op_mini all"
],
...
}
```
to the following:
```json
"browserslist": {
"production": [
"defaults",
"not ie 11"
],
...
}
```
**2.** Rebuild your production application using `npx run build`.
**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.
## Jest
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:
Expand Down

0 comments on commit d28ac1f

Please sign in to comment.