capacitor-community / capacitor-community/react-hooks

Bug: Failed to parse source map from on Ionic 6 with react-scripts@5

Open
#43 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
267
Forks
24
PR merge metrics
No merged PRs in 30d

Description

**Describe the bug**
After upgrading to react-script@5 the following error appears in the console: Failed to parse source map from

[The problem](https://github.com/ionic-team/ionic-framework/issues/24848#issuecomment-1050886458):
The problem here is that Ionic React 6 uses react-scripts@5. This new version of react-scripts has sourcemap parsing enabled and will log a warning when no sourcemaps are found for a library. This did not happen in Ionic React 5 as that version required react-scripts@4 which did not have sourcemap parsing.

**To Reproduce**
Steps to reproduce the behavior:
```bash
$ npm install -g @ionic/cli
$ ionic start myApp blank --type=react
$ cd myApp
$ npm install @capacitor/browser
$ npm install @capacitor-community/browser-react
$ ionic serve
```

**Screenshots**
capacitor-react-hooks-sourcemaps

## Possible solution:

The same thing happened to me with a library we created to display images with pinch-to-zoom in Ionic React.
https://github.com/codesyntax/ionic-react-photo-viewer

In my case I have used rollupjs as a module builder, and adding the sourcemaps in the configuration works perfectly.
Example: https://github.com/codesyntax/ionic-react-photo-viewer/pull/14/files

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.