2

NPM recommended I upgrade aws-amplify to the latest version yesterday, which I did. I then started a new React project in a dev environment (using "npm start"). The package.json file indicates these dependency versions:

  "dependencies": {
    "@aws-amplify/ui-react": "^2.15.1",
    "aws-amplify": "^4.3.18",
    "maplibre-gl-js-amplify": "^1.4.1",
    ... (other irrelevant dependencies removed for this example)
  },

Upon calling the line below:

import { withAuthenticator } from '@aws-amplify/ui-react';

I get 12 similar errors of the same issue. Here is one such error:

WARNING in ./node_modules/@aws-amplify/ui-react/node_modules/maplibre-gl-js-amplify/lib/esm/AmplifyMapLibreGeocoder.js
Module Warning (from ./node_modules/source-map-loader/dist/cjs.js):
Failed to parse source map from 'C:\projects\amplify-project\node_modules\@aws-amplify\ui-react\node_modules\maplibre-gl-js-amplify\src\AmplifyMapLibreGeocoder.ts' file: Error: ENOENT: no such file or directory, open 'C:\projects\amplify-project\node_modules\@aws-amplify\ui-react\node_modules\maplibre-gl-js-amplify\src\AmplifyMapLibreGeocoder.ts'
 @ ./node_modules/@aws-amplify/ui-react/node_modules/maplibre-gl-js-amplify/lib/esm/index.js 3:0-86 6:0-134 6:0-134
 @ ./node_modules/@aws-amplify/ui-react/dist/esm/components/Geo/MapView/index.js 5:0-69 35:16-17
 @ ./node_modules/@aws-amplify/ui-react/dist/esm/index.js 13:0-60 13:0-60
 @ ./src/App.js 9:0-58
 @ ./src/index.js 8:0-24 16:33-36

maplibre-gl-js-amplify is a dependency, though not one I am even using.

I notice in the error that it's referencing the "C:\projects\amplify-project\node_modules@aws-amplify\ui-react\node_modules\maplibre-gl-js-amplify\src" directory.

However, when I navigate to "C:\projects\amplify-project\node_modules@aws-amplify\ui-react\node_modules\maplibre-gl-js-amplify", there IS no src directory!

The "C:\projects\amplify-project\node_modules@aws-amplify\ui-react\node_modules\maplibre-gl-js-amplify" directory only has dist and lib directories.

When researching, I looked at the github repo and see there is a src directory but no dist or lib directories, with different files in the file structure:

https://github.com/aws-amplify/maplibre-gl-js-amplify

I don't know if the recent changes to aws-amplify caused this new issue or not but bottom line is, it appears that Amplify is calling resources in the src directory erroneously, or is referencing the development version of this repo and not the distribution version.

Any ideas on why this is happening and how to fix?

  • 1
    hi @arion-gnotta, I had the same issue as well when using the `withAuthenticator`. you can fix it by adding `mapbox-gl` module to your project `npm i mapbox-gl` – helman Apr 14 '22 at 07:56
  • it's a known issue https://github.com/aws-amplify/amplify-ui/issues/1647 – helman Apr 14 '22 at 08:08
  • At the very least, upgrading to version 2.15.2 should lower your bundle size, but possibly still show warnings or errors. – Joel Quiles Apr 19 '22 at 21:02

0 Answers0