Improve detection of missing dependencies #33659
Unanswered
aaronadamsCA
asked this question in
Ideas / Feature Requests
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Preliminary Checks
Description
When a site lists a package in
gatsby-config.js
, but the package is (recursively) missing frompackage.json
, Gatsby should throw a warning or error during the config validation step, because it can cause very confusing errors that are hard to diagnose.Reproduction Link
https://github.com/aaronadamsCA/gatsby-issue-theme-plugin-jsx
Steps to Reproduce
Two ways to reproduce within a monorepo:
gatsby-browser.js
.gatsby-config.js
, but not itspackage.json
.gatsby develop
.The provided reproduction link does this:
gatsby-plugin-image
(which uses JSX in itsgatsby-browser.js
) and/orgatsby-plugin-theme-ui
(which uses JSX in itsgatsby-browser.js
andgatsby-ssr.js
).gatsby-config.js
, but not itspackage.json
.gatsby develop
.Expected Result
When Gatsby validates
gatsby-config.js
, it should see that a package is configured but no corresponding dependency is defined, and throw an error (or at least a warning) that clearly indicates the problem.Actual Result
Execution continues, but packages missing from
package.json
files are not transpiled by Webpack/Babel as they ordinarily would be.As a result, they throw errors like these:
I believe this is the root cause of many reported issues, including #29979, where I believe these monorepos simply haven't defined explicit dependency chains, as well as #19042, #30516, (maybe) #32397, and possibly others.
Given how deeply challenging this is to diagnose, I think if Gatsby continues to depend on
package.json
parsing when choosing which packages to transpile, then there needs to be a clear error message when a dependency is expected but not found.Thanks!
Environment
Config Flags
No response
Beta Was this translation helpful? Give feedback.
All reactions