Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: Add troubleshooting steps for CRA and Geo components #2511

Merged
merged 2 commits into from
Aug 24, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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