-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
relay-compiler has implicit dependency on lodash>=4 and core-js<3 #2759
Comments
This is still an issue with 5.0.0. |
check here https://github.com/facebook/relay/search?q=lodash%2Fclone&unscoped_q=lodash%2Fclone it is only a dev dependency on lodash when running yarn why sibelius-pro:relay sibelius$ yarn why lodash/clone
yarn why v1.16.0
[1/4] 🤔 Why do we have the module "lodash/clone"...?
[2/4] 🚚 Initialising dependency graph...
[3/4] 🔍 Finding dependency...
[4/4] 🚡 Calculating file sizes...
=> Found "lodash@4.17.11"
info Reasons this module exists
- "eslint-plugin-flowtype" depends on it
- Hoisted from "eslint-plugin-flowtype#lodash"
- Hoisted from "@babel#core#lodash"
- Hoisted from "@babel#types#lodash"
- Hoisted from "@babel#traverse#lodash"
- Hoisted from "@babel#generator#lodash"
- Hoisted from "eslint#lodash"
- Hoisted from "babel-preset-fbjs#@babel#plugin-transform-block-scoping#lodash"
- Hoisted from "@babel#plugin-transform-modules-commonjs#@babel#helper-module-transforms#lodash"
- Hoisted from "eslint#table#lodash"
- Hoisted from "eslint#inquirer#lodash"
- Hoisted from "babel-preset-fbjs#@babel#plugin-transform-classes#@babel#helper-define-map#lodash"
- Hoisted from "jest#jest-cli#jest-config#jest-environment-jsdom#jsdom#request-promise-native#request-promise-core#lodash"
info Disk size without dependencies: "4.86MB"
info Disk size with unique dependencies: "4.86MB"
info Disk size with transitive dependencies: "4.86MB"
info Number of shared dependencies: 0
✨ Done in 1.04s. not sure why is this throwing for you |
might be a symptom of the same issue i described here: #2698 (comment) |
I think that might be it, at least for me! Thanks! Hoping that #2764 fixes it. |
Something is broken in the webpack config we use. After the build, the dist/relay-compiler file contains a bunch of |
Just saw #2764, that makes sense to me. Fingers crossed that fixes it! |
Summary: See background in #2759. Before this change, the `relay-compiler` binary pulls in `lodash`: ``` dist/relay-compiler/bin/relay-compiler 23734:module.exports = require("lodash/clone"); 26487:module.exports = require("lodash/uniq"); 27035:module.exports = require("lodash/isPlainObject"); 27041:module.exports = require("lodash/isRegExp"); 28413:module.exports = require("lodash/isInteger"); 28419:module.exports = require("lodash/repeat"); ``` And, only these files in `dist/` reference `lodash`: ``` $ rg lodash dist/ -l dist/relay-compiler/relay-compiler.js dist/relay-compiler/relay-compiler.min.js dist/relay-compiler/bin/relay-compiler ``` After this change, no files in `dist/` contain references to `lodash`. This seems consistent with what's contained in Relay packages before they were upgraded to Babel 7 (where the `@` was added) in #2536. Pull Request resolved: #2764 Reviewed By: alunyov Differential Revision: D15793295 Pulled By: kassens fbshipit-source-id: 14e9cc6d83a57d6853d8e41e82296d15f27750b2
This should be fixed in the next release thanks to #2764. |
All credit to @robrichard for tracking down the root cause! @kassens any chance of a minor release in the near future? This is blocking us from upgrading past 1.7.0. |
Hi there! I've been working on upgrading our codebase to Relay 4.0.0 and ran into a few roadblocks. It seems that
relay-compiler
has an implicit (i.e. not specified inpackage.json
and therefore not resolved bynpm install
when installingrelay-compiler
) dependency onlodash>=4
, and that if your application explicitly pinslodash<4
(for historical reasons, let's not dive into that),relay-compiler
can't run at all because it can't importlodash/clone
:I've built a minimal reproducer at https://github.com/wyattanderson/relay-lodash-reproducer which you can trigger by cloning, running
npm install
, and then runningnode_modules/.bin/relay-compiler --extensions jsx --schema schema.graphql --src src/
, which will crash with the above error.And, there's a bonus! On the
core-js
branch in that repository, I've pinnedcore-js@3.1.3
(the latest version), and the same steps reproduce the issue in #2701:The text was updated successfully, but these errors were encountered: