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): Pass reporter from functions code for reporting warning #31336

Merged
merged 2 commits into from
May 11, 2021

Conversation

KyleAMathews
Copy link
Contributor

@KyleAMathews KyleAMathews commented May 7, 2021

Also include the file that the warning is for in the message.

Fix for #30735 (comment)

Also include the file that the warning is for in the message
@gatsbot gatsbot bot added the status: triage needed Issue or pull request that need to be triaged and assigned to a reviewer label May 7, 2021
@KyleAMathews KyleAMathews added topic: functions and removed status: triage needed Issue or pull request that need to be triaged and assigned to a reviewer labels May 7, 2021
@@ -148,7 +148,9 @@ export const reportWebpackWarnings = (
warnings: StatsCompilation["warnings"] = [],
reporter: Reporter
): void => {
const warningMessages = warnings.map(warning => warning.message)
const warningMessages = warnings.map(
warning => `${warning.moduleName}\n\n${warning.message}`
Copy link
Contributor Author

@KyleAMathews KyleAMathews May 7, 2021

Choose a reason for hiding this comment

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

make the warning a lot more useful — say which file it's from.

Thinking we don't need formatWebpackMessages any more w/ webpack 5? We just pass it a string which it now returns... 🤷

Warnings look like this now:
Screen Shot 2021-05-07 at 4 37 32 PM

Copy link
Contributor

Choose a reason for hiding this comment

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

formatWebpackMessages does more than formatting. It also rewrites errors to a more actionable ones.

https://github.com/facebook/create-react-app/blob/master/packages/react-dev-utils/formatWebpackMessages.js

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The stats warnings/error object changed in v5 — see #30801 & facebook/create-react-app#9943

Copy link
Contributor Author

@KyleAMathews KyleAMathews May 10, 2021

Choose a reason for hiding this comment

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

but yeah, to your point, the message rewritings should still apply so we still want it

@wardpeet wardpeet merged commit f09fae8 into master May 11, 2021
@wardpeet wardpeet deleted the pass-reporter branch May 11, 2021 06:00
vladar pushed a commit that referenced this pull request May 11, 2021
…31336)

* fix(gatsby): Pass reporter from functions code for reporting warning

Also include the file that the warning is for in the message

* Update packages/gatsby/src/internal-plugins/functions/gatsby-node.ts

Co-authored-by: Ward Peeters <[email protected]>

Co-authored-by: Ward Peeters <[email protected]>
(cherry picked from commit f09fae8)
vladar pushed a commit that referenced this pull request May 11, 2021
…31336) (#31363)

* fix(gatsby): Pass reporter from functions code for reporting warning

Also include the file that the warning is for in the message

* Update packages/gatsby/src/internal-plugins/functions/gatsby-node.ts

Co-authored-by: Ward Peeters <[email protected]>

Co-authored-by: Ward Peeters <[email protected]>
(cherry picked from commit f09fae8)

Co-authored-by: Kyle Mathews <[email protected]>
axe312ger pushed a commit that referenced this pull request May 20, 2021
…31336)

* fix(gatsby): Pass reporter from functions code for reporting warning

Also include the file that the warning is for in the message

* Update packages/gatsby/src/internal-plugins/functions/gatsby-node.ts

Co-authored-by: Ward Peeters <[email protected]>

Co-authored-by: Ward Peeters <[email protected]>
@LekoArts LekoArts added the topic: DX Developer Experience (e.g. Fast Refresh, i18n, SSR, page creation, starters) label May 28, 2021
This was referenced Mar 14, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
topic: DX Developer Experience (e.g. Fast Refresh, i18n, SSR, page creation, starters)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants