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

fix(gatsby): always pass stage option to babel-preset-gatsby #30047

Merged
merged 1 commit into from
Mar 5, 2021

Conversation

vladar
Copy link
Contributor

@vladar vladar commented Mar 5, 2021

Description

Before v3 babel-preset-gatsby was using process.env.GATSBY_BUILD_STAGE variable to capture current build phase (and was adjusting config accordingly).

But we've removed this for v3 here:

- // TODO(v3): Remove process.env.GATSBY_BUILD_STAGE, needs to be passed as an option
- const stage = options.stage || process.env.GATSBY_BUILD_STAGE || `test`
+ const stage = options.stage || `test`

I guess the idea was to always pass stage in babel-loader options. But we don't do this now for user-defined .babelrc.

This PR fixes it and always passes the stage option with babel-preset-gatsby even if it was set in user-defined .babelrc.

Without it, hot-reloading is not working with custom babel config. And who knows what else can potentially break.

Related Issues

Fixes #30017

@gatsbot gatsbot bot added the status: triage needed Issue or pull request that need to be triaged and assigned to a reviewer label Mar 5, 2021
@vladar vladar added topic: webpack/babel Webpack or babel and removed status: triage needed Issue or pull request that need to be triaged and assigned to a reviewer labels Mar 5, 2021
@vladar vladar added this to To cherry-pick in V3 Release Hotfixes via automation Mar 5, 2021
Copy link
Contributor

@pieh pieh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That makes sense, thanks!

@vladar vladar merged commit 8cedc8d into master Mar 5, 2021
@vladar vladar deleted the vladar/fix-babel-loader branch March 5, 2021 20:25
vladar added a commit that referenced this pull request Mar 5, 2021
@vladar vladar moved this from To cherry-pick to Backport PR opened in V3 Release Hotfixes Mar 5, 2021
vladar added a commit that referenced this pull request Mar 5, 2021
) (#30051)

(cherry picked from commit 8cedc8d)

Co-authored-by: Vladimir Razuvaev <vladimir.razuvaev@gmail.com>
@vladar vladar moved this from Backport PR opened to Backported in V3 Release Hotfixes Mar 5, 2021
@vladar
Copy link
Contributor Author

vladar commented Mar 5, 2021

Published in gatsby@3.0.3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
topic: webpack/babel Webpack or babel
Projects
No open projects
Development

Successfully merging this pull request may close these issues.

Hot reload is not working when using custom babel config
2 participants