-
Notifications
You must be signed in to change notification settings - Fork 10.3k
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
fail fast/eslint plugin that checks for window
#12769
Comments
@kentcdodds this would be super slick, and agreed, I've seen people suffer through a broken build while they iron out usages of globals in SSR environment. Giving actionable feedback prior to failing in build is key here. I've never written an eslint plugin, but this certainly seems like something that could be doable--so we'll take a look and prioritize appropriately! Thanks for the idea! |
Watching jsx-eslint/eslint-plugin-react#2057 closely |
Hiya! This issue has gone quiet. Spooky quiet. 👻 We get a lot of issues, so we currently close issues after 30 days of inactivity. It’s been at least 20 days since the last update here. If we missed this issue or if you want to keep it open, please reply here. You can also add the label "not stale" to keep this issue open! Thanks for being a part of the Gatsby community! 💪💜 |
Hey again! It’s been 30 days since anything happened on this issue, so our friendly neighborhood robot (that’s me!) is going to close it. Please keep in mind that I’m only a robot, so if I’ve closed this issue in error, I’m As a friendly reminder: the best way to see this issue, or any other, fixed is to open a Pull Request. Check out gatsby.dev/contribute for more information about opening PRs, triaging issues, and contributing! Thanks again for being part of the Gatsby community! |
We have solved this with SSR in Development now: #28138 |
Summary
I wish I could say I never make this mistake, but I make it pretty often. The error message I get when building is:
The problem is I'm referencing
window
in the render method. This works fine indev
, but it doesn't work when runninggatsby build
.Motivation
I know that it's my problem. But it'd be cool if
gatsby develop
would give me a warning if it detected something that wont work for thebuild
. There could be other situations, but I know that at least referencing browser-only globals in therender
method doesn't work during thebuild
but works duringdevelop
and I don't realize something's wrong until it breaks in CI.So I'd really appreciate some sort of gatsby eslint plugin (like suggested in #7687) or (even better) an error in
develop
for anything that would fail inbuild
.The text was updated successfully, but these errors were encountered: