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-plugin-preact): Adjust framework chunk overwrite #37658

Merged
merged 1 commit into from
Feb 15, 2023

Conversation

LekoArts
Copy link
Contributor

Description

With #37508 our internals for the framework chunk changed. I decided to not do the optimization for react-dom/server yet as we haven't heard complaints about that in combination with Preact and its compat layer also works different so I'm not convinced that this is even needed. We could change it at a later stage, for now I just wanted to fix the test itself.

Testing

Used gatsby-plugin-preact in a test site, chunking seems correct:

image

Related Issues

Fixes #37653

@LekoArts LekoArts added the topic: plugins Related to plugin system, themes & catch-all for plugins that don't have a label label Feb 15, 2023
@gatsbot gatsbot bot added the status: triage needed Issue or pull request that need to be triaged and assigned to a reviewer label Feb 15, 2023
@LekoArts LekoArts removed the status: triage needed Issue or pull request that need to be triaged and assigned to a reviewer label Feb 15, 2023
@@ -121,7 +138,7 @@ describe(`gatsby-plugin-preact`, () => {
"enforce": true,
"name": "framework",
"priority": 40,
"test": [Function],
"test": /\\(\\?<!node_modules\\.\\*\\)\\[\\\\\\\\/\\]node_modules\\[\\\\\\\\/\\]\\(preact\\|react\\|react-dom\\|scheduler\\|prop-types\\)\\[\\\\\\\\/\\]/,
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Previously this was the function:

module =>
          /(?<!node_modules.*)[\\/]node_modules[\\/](preact)[\\/]/.test(
            module.resource
          )

@@ -141,7 +158,7 @@ describe(`gatsby-plugin-preact`, () => {
"enforce": true,
"name": "framework",
"priority": 40,
"test": /\\(\\?<!node_modules\\.\\*\\)\\[\\\\\\\\/\\]node_modules\\[\\\\\\\\/\\]\\(react\\|react-dom\\|scheduler\\|prop-types\\)\\[\\\\\\\\/\\]/,
"test": [Function],
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Previously this was the regex in the mock above

@@ -1,5 +1,20 @@
const PreactRefreshPlugin = require(`@prefresh/webpack`)

const FRAMEWORK_BUNDLES_PREACT = [
`preact`,
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Main change: Adding preact to this regex and then just using this regex instead of trying to reuse what Gatsby framework itself uses

@LekoArts LekoArts requested a review from pieh February 15, 2023 08:26
@LekoArts LekoArts added this to To cherry-pick in V5 Release hotfixes via automation Feb 15, 2023
@LekoArts LekoArts merged commit d47ef5e into master Feb 15, 2023
@LekoArts LekoArts deleted the fix-preact-regression-37653 branch February 15, 2023 09:52
@amalitsky
Copy link
Contributor

Man, you are using statoscope, this is soo awesome! Didn't realize that.

cc @smelukov

LekoArts added a commit that referenced this pull request Feb 16, 2023
@LekoArts LekoArts moved this from To cherry-pick to Backport PR opened in V5 Release hotfixes Feb 16, 2023
@LekoArts
Copy link
Contributor Author

Yeah, great tool! I use it through https://github.com/LekoArts/gatsby-plugin-webpack-statoscope

LekoArts added a commit that referenced this pull request Feb 16, 2023
@LekoArts LekoArts moved this from Backport PR opened to Published in V5 Release hotfixes Feb 16, 2023
@LekoArts
Copy link
Contributor Author

Published in gatsby-plugin-preact@7.6.1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
topic: plugins Related to plugin system, themes & catch-all for plugins that don't have a label
Projects
Development

Successfully merging this pull request may close these issues.

gatsby-plugin-preact 7.6.0 doesn't work with gatsby 5.6.0
3 participants