-
Notifications
You must be signed in to change notification settings - Fork 10.3k
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): [rendering engines] use results of exports removal if sourceMap was not generated alongside transformed code #37282
fix(gatsby): [rendering engines] use results of exports removal if sourceMap was not generated alongside transformed code #37282
Conversation
…urceMap was not generated alongside transformed code
@@ -18,9 +18,11 @@ node node_modules/gatsby/dist/schema/graphql-engine/standalone-regenerate.js | |||
*/ | |||
|
|||
import { createGraphqlEngineBundle } from "./bundle-webpack" | |||
import { createPageSSRBundle } from "./../../utils/page-ssr-module/bundle-webpack" |
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.
changes in packages/gatsby/src/schema/graphql-engine/standalone-regenerate.ts
are unrelated to fix itself, just some dev tools update that I did as part of my investigation that I think make sense to commit in general - I can drop this change from this PR (and either create separate or just skip pushing it)
} else if (result && result.code && result.map) { | ||
callback(null, result?.code, result?.map) | ||
} else if (result && result.code) { | ||
callback(null, result?.code, result?.map ?? undefined) | ||
} else { | ||
callback(null, source, sourceMap) | ||
} |
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.
Actual fix here - sometimes we will get result.code
with falsyt result.map
, this change make sure we use that and only fallback to pass original source (and sourceMap) if transformed code is falsy or we get no result at all (not sure if that can ever happen without error)
…urceMap was not generated alongside transformed code (#37282) (#37296) * fix(gatsby): [rendering engines] use results of exports removal if sourceMap was not generated alongside transformed code * chore: regenerate also page-ssr bundle in standalone-regenerate (cherry picked from commit 770748d) Co-authored-by: Michal Piechowiak <misiek.piechowiak@gmail.com>
…urceMap was not generated alongside transformed code (#37282) (#37299) * fix(gatsby): [rendering engines] use results of exports removal if sourceMap was not generated alongside transformed code * chore: regenerate also page-ssr bundle in standalone-regenerate (cherry picked from commit 770748d) Co-authored-by: Michal Piechowiak <misiek.piechowiak@gmail.com>
Description
We use custom loader to remove gatsby-node lifecycles that are not relevant to engines runtime in
gatsby/packages/gatsby/src/schema/graphql-engine/bundle-webpack.ts
Lines 114 to 131 in 86e1685
This however is currently not always working as expected as the loader currently expect sourceMap to be generated alongside transformed code before using the transformed code. If map is not generated we discard transformed code.
This PR allow usage of transformed code if it's not accompanied by sourcemap - we will only do passthrough if transformed code is not generated.
Documentation
Related Issues