-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
[Feature] Improve the Gatsby E2E #689
Comments
Hey @kevin940726 ! Thanks a lot for investigating ! I have a few comments: First, I remember there were a few similar issues in the past. I fixed that by adding "fallbacks", where if a package is missing then we still try to see whether it's a dependency of Gatsby (and react-scripts, for CRA): https://github.com/yarnpkg/berry/blob/master/packages/yarnpkg-pnp/sources/loader/makeApi.ts#L52-L64. That was a long time ago, almost a year. Then a few months ago, I implemented Now as how to fix, it: I didn't think it would still be a problem actually! From my understanding, ESLint 6 should load configs and plugins relative to the configuration that imports them, so I'm surprised this isn't the case - do you have an idea why?
|
Found the problem! I've opened gatsbyjs/gatsby#20629 which I think should fix that - can you confirm @kevin940726, to make sure I'm not missing something? |
@arcanis Just tried that and it works perfectly! I can help add e2e tests to the gatsby workflow for this, and we can merge it after the upstream released a new version. I believe there are still some other issues with popular gatsby plugins though. I'll keep investigating. One question: why do we want to provide |
Yep, I think Eslint allows config paths to be absolute because it doesn't matter if the same config is loaded twice, but they don't support absolute plugin paths because reason. Imo the "plugin relative path" option should also be applied to the config lookup, but since it isn't.. Easier to use an absolute path here than open an issue on Eslint, especially given a change here would likely be breaking 😛
Awesome! I think we can even start figuring out what the I think the easiest might be to spawn the process and aggregate its output somewhere, wait until it publishes the initial bundle to the local port, then look for errors in the buffered logs. Wdyt? |
Some updates on the plugins I found which are incompatible to berry.
I have 2 solutions for now.
Personally I think (2) would be a better choice as the maintainer don't have to remember to also update all the dependencies when updating I wonder what's the general solution for this kind of problem. I've already implemented (2) locally (and tested) and ready to send the PR to gatsby if that sounds good to you. One addition problem would be that As long as it's done, I can add |
That's exactly what I thought! We can use |
I'd usually recommend (1) as it makes the dependency tree more explicit. That said,
Gatsby already has a util for this here. If we go down the Nice! Wasn't aware of this tool, it seems to be what we'd be looking for 👍 As for the logs, maybe we can just grep for |
Oops! I didn't notice that they have this! This is nice, looks like we can just use this 👍 I guess that I can open up a PR to gatsby with the second approach, and briefly mention the alternative solution (1) with this issue to them, and let them decide which one to adopt 😉.
~Yah that makes the most sense, and it's all we can do for now. Let's just hope that webpack/gatsby won't change their error output anytime soon 😂 I wonder if there're some kind of secret options for webpack to output the log differently when in CI environment 🤔. I'll do some digging.~ Hmmm, nvm... I think for now all we have to do is to check that |
The fix has been released! Note to self: I need to check Sherlock, something changed and it can't send comments anymore: |
It has now been merged 🎉! I think we can close this now. Let's add following issues if there are any. |
Describe the bug
As mentioned in #681 (comment). As from the latest version of
gatsby
, yarn berry no longer work properly with it.yarn build
works perfectly, butyarn start
will result in an error shown below.To Reproduce
Update the
gatsby
dependency to the latest version by runningThen run the development server
We can also reproduce it by creating a new gatsby project
yarn dlx gatsby new berry-gatsby cd berry-gatsby yarn start
We only covered
yarn build
in our e2e test, so it didn't catch that.Sherlock:
Screenshots
Environment if relevant (please complete the following information):
Additional context
Note that it's not happening with the current version we used in our website (2.13.6). Looks like the problem is with
eslint-loader
or more specifically how gatsby uses it. By filtering out theeslint-loader
rule in webpack config can no longer reproduce the issue. I haven't looked into the source or diff the versions to find the root cause yet. I'll continue try to find it, it's fun!Update 1:
I'm able to pin point the problem toeslint-config-react-app
. Downgrading it to^4
fixes the issue. I'll continue to try to find what goes wrong.Update 2:
Seems like it's happening because of
eslint
actually. Especially in this line when it tries to callModule.createRequire('CWD/__placeholder__.js').require('eslint-config-react-app')
will results in a failure. I'll try to create a minimal reproduce steps for eslint.Update 3:
Since that gatsby bundles
eslint-config-react-app
inside thegatsby
package, so that the user won't have to install that package themselves. However, requiring the package is handled byeslint
, which requires fromcwd
, i.e. the user package root, hence the error.I have no idea how to fix it now though, I'm sure that it's something happens a lot in other packages too, maybe @arcanis has an idea?
The text was updated successfully, but these errors were encountered: