Adding a possible fix to address the issue reported in #45 where gatsby build in Gatsby v4 fails in the Validating Rendering Engines step.
Details
gatsby build run in v4 with gatsby-plugin-loadable-components-ssr fails in the Validating Rendering Engines step with the following error message :
failed Validating Rendering Engines - 1.942s
ERROR #98001 WEBPACK
Built Rendering Engines failed validation failed validation.
Please open an issue with a reproduction at https://github.com/gatsbyjs/gatsby/issues/new for more help
Error: Generated engines use disallowed import "gatsby-project/.cache/loadable-stats-build-javascript.json". Only allowed imports are to Node.js builtin modules or engines internals.
This PR adds the allowed page-ssr prefix to the path and also adds a slight refactor so the loadable-stats file path can be used across gatsby-ssr and gatsby-node.
Unsure of all the use-cases to check for this, but this fix all seems to be working for me. Entirely possible something was missed, but hopefully this PR helps :)
Summary
Adding a possible fix to address the issue reported in #45 where
gatsby build
in Gatsby v4 fails in the Validating Rendering Engines step.Details
gatsby build
run in v4 with gatsby-plugin-loadable-components-ssr fails in the Validating Rendering Engines step with the following error message :It seems that validation handling was added in Gatsby v4 which checks artifact paths against an allowed prefix list (specifically here).
This PR adds the allowed
page-ssr
prefix to the path and also adds a slight refactor so the loadable-stats file path can be used across gatsby-ssr and gatsby-node.Unsure of all the use-cases to check for this, but this fix all seems to be working for me. Entirely possible something was missed, but hopefully this PR helps :)