-
Notifications
You must be signed in to change notification settings - Fork 10.3k
fix(gatsby-plugin-preact): Adjust framework chunk overwrite #37658
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
Conversation
@@ -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\\)\\[\\\\\\\\/\\]/, |
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.
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], |
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.
Previously this was the regex in the mock above
@@ -1,5 +1,20 @@ | |||
const PreactRefreshPlugin = require(`@prefresh/webpack`) | |||
|
|||
const FRAMEWORK_BUNDLES_PREACT = [ | |||
`preact`, |
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.
Main change: Adding preact
to this regex and then just using this regex instead of trying to reuse what Gatsby framework itself uses
Man, you are using statoscope, this is soo awesome! Didn't realize that. cc @smelukov |
(cherry picked from commit d47ef5e)
Yeah, great tool! I use it through https://github.com/LekoArts/gatsby-plugin-webpack-statoscope |
Published in |
Description
With #37508 our internals for the
framework
chunk changed. I decided to not do the optimization forreact-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:Related Issues
Fixes #37653