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

Fails with collision warning on Expo 42 & AWS Amplify #63

Closed
hani-q opened this issue Aug 4, 2021 · 2 comments
Closed

Fails with collision warning on Expo 42 & AWS Amplify #63

hani-q opened this issue Aug 4, 2021 · 2 comments

Comments

@hani-q
Copy link

hani-q commented Aug 4, 2021

On EXPO SDK42 project with with AWS-Amplify i get the below error

yarn run react-native-bundle-visualizer --expo managed
yarn run v1.22.4
$ C:\work\code\tadeeb\node_modules\.bin\react-native-bundle-visualizer --expo managed
Generating bundle...
                 Welcome to React Native!
                Learn once, write anywhere

Error: Duplicated files or mocks. Please check the console for more info
    at setModule (C:\work\code\tadeeb\node_modules\metro\node_modules\jest-haste-map\build\index.js:620:17) 
    at workerReply (C:\work\code\tadeeb\node_modules\metro\node_modules\jest-haste-map\build\index.js:691:9)
    at runMicrotasks (<anonymous>)
    at processTicksAndRejections (internal/process/task_queues.js:97:5)
    at async Promise.all (index 25277)
(node:21552) UnhandledPromiseRejectionWarning: Error: Command failed with exit code 1: ./node_modules/.bin/react-native bundle --platform ios --dev false --entry-file ./node_modules/expo/AppEntry.js --bundle-output C:\Users\hanan\AppData\Local\Temp\react-native-bundle-visualizer\tadeeb\ios.bundle --sourcemap-output C:\Users\hanan\AppData\Local\Temp\react-native-bundle-visualizer\tadeeb\ios.bundle.map --config C:\work\code\tadeeb\node_modules\react-native-bundle-visualizer\src\expo-metro.config.js
jest-haste-map: Haste module naming collision: tadeeb0bd7c964CustomMessage
  The following files share their name; please adjust your hasteImpl:
    * <rootDir>\amplify\#current-cloud-backend\function\tadeeb0bd7c964CustomMessage\src\package.json
    * <rootDir>\amplify\backend\function\tadeeb0bd7c964CustomMessage\src\package.json

Failed to construct transformer:  DuplicateError: Duplicated files or mocks. Please check the console for more info
    at setModule (C:\work\code\tadeeb\node_modules\metro\node_modules\jest-haste-map\build\index.js:620:17)
    at workerReply (C:\work\code\tadeeb\node_modules\metro\node_modules\jest-haste-map\build\index.js:691:9)
    at runMicrotasks (<anonymous>)
    at processTicksAndRejections (internal/process/task_queues.js:97:5)
    at async Promise.all (index 25277) {
  mockPath1: 'amplify\\#current-cloud-backend\\function\\tadeeb0bd7c964CustomMessage\\src\\package.json',
  mockPath2: 'amplify\\backend\\function\\tadeeb0bd7c964CustomMessage\\src\\package.json'
}
error Duplicated files or mocks. Please check the console for more info. Run CLI with --verbose flag for more details.
                 Welcome to React Native!
                Learn once, write anywhere


Error: Duplicated files or mocks. Please check the console for more info
    at setModule (C:\work\code\tadeeb\node_modules\metro\node_modules\jest-haste-map\build\index.js:620:17)
    at workerReply (C:\work\code\tadeeb\node_modules\metro\node_modules\jest-haste-map\build\index.js:691:9)
    at runMicrotasks (<anonymous>)
    at processTicksAndRejections (internal/process/task_queues.js:97:5)
    at async Promise.all (index 25277)
    at makeError (C:\work\code\tadeeb\node_modules\react-native-bundle-visualizer\node_modules\execa\lib\error.js:60:11)
    at handlePromise (C:\work\code\tadeeb\node_modules\react-native-bundle-visualizer\node_modules\execa\index.js:118:26)
    at processTicksAndRejections (internal/process/task_queues.js:97:5)
(node:21552) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:21552) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
Done in 5.75s.
PS C:\work\code\tadeeb> 

On the amplify repo

amazon-archives/awsmobile-cli#172

They are suggesting to add a "rn-cli.config.js" with the below content

const blacklist = require('metro-config/src/defaults/blacklist');

module.exports = {
    resolver: {
        blacklistRE: blacklist([/#current-cloud-backend\/.*/]),
    },
};

But didnt fix the issue.. also added it in expo package.json

 "packagerOpts": {
            "config": "./rn-cli.config.js"
        },

But result still same.

@IjzerenHein
Copy link
Owner

IjzerenHein commented Aug 5, 2021

Hi, please provide a way to reproduce this problem. Either through a minimalistic example project or by outlining the steps to perform (eg on a base Expo SDK 42 project).

Also note that as of Expo SDK 41, you no longer need to use --expo managed:

@hani-q
Copy link
Author

hani-q commented Aug 5, 2021

Hi,

Funny running it without the --expo managed flag fixed the issue :)

$ C:\work\code\tadeeb\node_modules\.bin\react-native-bundle-visualizer
Generating bundle...
                 Welcome to React Native!
                Learn once, write anywhere


info Writing bundle output to:, C:\Users\hanan\AppData\Local\Temp\react-native-bundle-visualizer\tadeeb\ios.bundle
info Writing sourcemap output to:, C:\Users\hanan\AppData\Local\Temp\react-native-bundle-visualizer\tadeeb\ios.bundle.map
info Done writing bundle output
info Done writing sourcemap output
Bundle is 8.63 MB in size (unchanged since last run)
Unable to map 931598/9046695 bytes (10.30%)
Done in 46.75s.

@hani-q hani-q closed this as completed Aug 5, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants