-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
[MDX] Migration to gatsby-plugin-mdx v4 with fix for onCreatePage trigger issue #4585
Conversation
Signed-off-by: Randy Lau <randychilau@gmail.com>
Signed-off-by: Randy Lau <randychilau@gmail.com>
🚀 Preview for commit d8e08ae at: https://64b8cdb5900f064ab12c3be6--layer5.netlify.app |
Everything looks, actually good this time. |
Signed-off-by: Randy Lau <randychilau@gmail.com>
🚀 Preview for commit b8ec8f5 at: https://64bac90b210ccf0508d788eb--layer5.netlify.app |
Signed-off-by: Randy Lau <randychilau@gmail.com>
🚀 Preview for commit cb31caa at: https://64bad58a9338e10375d87a77--layer5.netlify.app |
Signed-off-by: Randy Lau <randychilau@gmail.com>
🚀 Preview for commit e4c1b8f at: https://64baf5fbcf89bc03a5636f85--layer5.netlify.app |
Please do discuss the PR on the Monday's website call if possible for you (time wise), and request for people to test out the preview. From, my side things look good and we can give this a go. |
gatsby-config.js
Outdated
@@ -72,7 +78,7 @@ module.exports = { | |||
overrides: { | |||
// or disable plugins | |||
inlineStyles: false, | |||
cleanupIDs: false, | |||
cleanupIds: false, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am guessing this resolves the cleanupIds
error that we are sseing during the build, right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for reviewing. Yes, that is correct.
Possible reason why:
The original property value came from Gatsby's docs.
but then I believe the warning started appearing in build logs after this package upgrade:
Bump @svgr/webpack from 6.5.1 to 8.0.1
#4467
and then when looking at the SVGO github's plugin chart, the property value had different casing:
After correcting the config settings with the SVGO casing the warning did not appear anymore.
Cheers!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@randychilau @Nikhil-Ladha, we're still seeing these messages while building. cleanupIds
is enabled by default as @randychilau pointed out. Do we know why it's necessary to disable this minification? At first blush, minification is ideal. Was having this enabled, corrupting some images?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should find that this mis-capitalization is once again corrected and that the warning messages disappear - 329de49#diff-b5e305780d9d473da97c61beab8bc36e5e8871b360942e4686c9b20d8c5d4cfaR75
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @leecalcote,
regarding the question:
"Do we know why it's necessary to disable this minification? At first blush, minification is ideal. Was having this enabled, corrupting some images?"
The cleanupIds
option is disabled to prevent conflicts of multiple SVGs on the same page:
Note: SVGO does not produce unique IDs when using the cleanupIDs option; if you’re using SVGs that rely on IDs (e.g. to target template elements with use) and include multiple SVGs on the same page you may wish to disable the cleanupIDs option to prevent conflicts. (src)
If I recall correctly, the Layer5 site required cleanupIds
to be false
so that pages with multiple SVGs could have a unique ID for each SVG that could be targeted for transitioning between light and dark mode.
Cheers,
Randy
Signed-off-by: Randy Lau <randychilau@gmail.com>
🚀 Preview for commit c594161 at: https://64bc318dc252e0225e126f4e--layer5.netlify.app |
Hi @Nikhil-Ladha, We discussed this PR on today's Website's call, and asked the community to test the preview and I believe someone also built the branch without issues. @leecalcote mentioned that this merge might be an issue for contributors who have experienced memory issues during the image-processing phase. Something I forgot to mention was that the memory issues were occurring during the Lee also mentioned potentially migrating to Gatsby 5 (which requires bump React 18 and includes a new webpack version) in this PR to see if the cold build time will come down. So as of now I see a few options:
My initial thought is if the choice is between option 2 or 3, then 3 would be the way to go since a Gatsby 5 migration can be done independent of MDX related upgrades and has its own benefits for the site. Happy to hear thoughts on the above and how to proceed. Cheers, |
Signed-off-by: Randy Lau <randychilau@gmail.com>
Signed-off-by: Randy Lau <randychilau@gmail.com>
Signed-off-by: Randy Lau <randychilau@gmail.com>
Signed-off-by: Randy Lau <randychilau@gmail.com>
Signed-off-by: Randy Lau <randychilau@gmail.com>
Signed-off-by: Randy Lau <randychilau@gmail.com>
🚀 Preview for commit 1e10f7a at: https://64f774de721d0f1471d942f0--layer5.netlify.app |
Signed-off-by: Randy Lau <randychilau@gmail.com>
Signed-off-by: Randy Lau <randychilau@gmail.com>
🚀 Preview for commit d4861ea at: https://64f77a7a28f3e016e67a88f9--layer5.netlify.app |
Signed-off-by: Randy Lau <randychilau@gmail.com>
Signed-off-by: Randy Lau <randychilau@gmail.com>
🚀 Preview for commit 3db1070 at: https://64f79759bfd6992f58637054--layer5.netlify.app |
Signed-off-by: Randy Lau <randychilau@gmail.com>
🚀 Preview for commit d64cd34 at: https://64f7a158767e580074fd3467--layer5.netlify.app |
Hi All, Reviewed the latest updates/changes for compatibility with MDX v2, and added them to this PR. This PR is waiting on the review and merging of PR #4646 (Gatsby v5). Afterwards, will merge those changes into this PR with the hope that migrating to Gatsby v5 (and new webpack) will address cold build times and memory requirements with MDX v2. Thanks, |
Signed-off-by: Randy Lau <randychilau@gmail.com>
🚀 Preview for commit 6245012 at: https://64ff5ed6ecfe833e585869b2--layer5.netlify.app |
Signed-off-by: Randy Lau <randychilau@gmail.com>
🚀 Preview for commit 228a0e4 at: https://650b43fdbb800d32b676c3a6--layer5.netlify.app |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
Description
This PR is a second try migrating to gatsby-plugin-mdx v4 (and MDXv2) which fixes an issue discovered in the first try (PR #4532).
The issue was that mdx pages were being handled differently in v4 when the env variable
CI
is set totrue
activating customizedonCreatePage
andenvCreatePage
functions.CI=true
is the default case for all Github Actions.As a result, mdx sourced pages which used the
children
feature of v4 were triggering the customized onCreatePage function which is designed to handle non-mdx sourced pages. Adding a conditional check forpath
ending in.html
resolves the issue.before (taken from the checks in PR 4532):
redirect loop example at /programs/gsoc in netlify site preview.
after (taken from the checks in this PR):
no redirect loop example at /programs/gsoc in netlify site preview.
Notes for Reviewers
Added section to
CONTRIBUTING.md
file with reminders when working ongatsby-node.js
and page creation/url/redirect.🌺 Thanks for everyone's patience and quick action to report issues, revert the PR, and discuss possible solutions.
Signed commits