Skip to content

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
"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
          )

"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

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 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
Copy link
Contributor Author

@LekoArts
Copy link
Contributor Author

Published in [email protected]

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

None yet

Development

Successfully merging this pull request may close these issues.

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

4 participants