Forum

[Solved] Module parse failed: Unexpected token / You may need an additional loader to handle the result of these loaders.

1
Topic starter

Facing below type of error while running project in local.

Failed to compile.

[data/home/ubuntu/Desktop/emergegen1-604372-react/src/node_modules/react-native-modal/dist/modal.js:47:22]
Module parse failed: Unexpected token (47:22)
File was processed with these loaders:
../../node_modules/react-scripts/node_modules/babel-loader/lib/index.js
You may need an additional loader to handle the result of these loaders.

> export class ReactNativeModal extends React.Component {
> static defaultProps = defaultProps;
> backHandler = null;
> // We use an internal state for keeping track of the modal visibility: this allows us to keep

1 Answer
1
Topic starter

Add any package or block that is causing an error (given in the question) to the resolveApp() function in the config-overrides.js file.

In the example above, the package with the issue is “react-native-modal”, so add the following line:

resolveApp("../../node_modules/react-native-modal");

NOTE : The above line applies to both packages and blocks that throw similar errors. Make sure to check the path inside the function according to other resolveApp() lines.

This post was modified 4 months ago by Prit Sapariya
This post was modified 4 months ago by Lps75