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

bundling failed: ReferenceError: SHA-1 for file .../node_modules/lodash.zip is not computed #441

Open
IgorBelyayev opened this issue Aug 10, 2019 · 3 comments

Comments

@IgorBelyayev
Copy link

Do you want to request a feature or report a bug?
Bug.

What is the current behavior?
Including lodash.zip as a dependency in my React-Native project causes the following error to be thrown by the metro bundler:

error: bundling failed: ReferenceError: SHA-1 for file /my_project_dir/node_modules/lodash.zip (/my_project_dir/node_modules/lodash.zip) is not computed
    at DependencyGraph.getSha1 (/my_project_dir/node_modules/metro/src/node-haste/DependencyGraph.js:259:13)
    at /my_project_dir/node_modules/metro/src/DeltaBundler/Transformer.js:211:26
    ...

My guess is that because the folder in node_modules for this particular dependency happens to be called something with '.zip' in it (lodash.zip), the bundler erroneously thinks that it is some sort of .zip file that it needs to check.

I am using metro version 0.54.1 which is the version used in the latest version of React-Native (0.60.4).

If the current behavior is a bug, please provide the steps to reproduce and a minimal repository on GitHub that we can yarn install and yarn test.

  1. Be in any React-Native project using RN 0.60.4 (metro version 0.54.1)
  2. yarn add lodash.zip
  3. react-native run-android
  4. Observe error described above.

What is the expected behavior?
The metro bundler should not fail bundling.

Please provide your exact Metro configuration and mention your Metro, node, yarn/npm version and operating system.
Metro configuration:

module.exports = {
  transformer: {
    getTransformOptions: async () => ({
      transform: {
        experimentalImportSupport: false,
        inlineRequires: false,
      },
    }),
  },
};

Metro version: 0.54.1
node: 12.4.0
yarn: 1.13.0
operating system: macOS Mojave 10.14.5

@jkirkpatrick24
Copy link

I'm coming across this issue as well. @IgorBelyayev did you come up with a workaround?

@IgorBelyayev
Copy link
Author

@jkirkpatrick24 Yes, instead of using lodash.zip in my dependencies, I just used the full lodash library and imported zip from it.

@jkirkpatrick24
Copy link

Ah, in my case this is a dependency of another module. I'd be happy to take a crack at a PR to fix this but would probably need some guidance on where to look in the codebase.

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