Open laurenskling opened 4 years ago
Right now the way to get this done would be:
if (
node.internal.type === "Printer" &&
node.component ===
require.resolve(
"gatsby-theme-devtips/src/printer-components/devtips-collection.js"
)
) {
node.component = require.resolve(
"./src/printer-components/devtips-collection.js"
);
}
as seen in use here.
This is obviously not a great pattern and I'm open to other ways to achieve it. Not sure if we can wrangle shadowing for this. Might be able to import or recreate the shadowing algorithm to make it look like it works the same way.
I am using Gatsby Theme Apollo. On this line: https://github.com/apollographql/gatsby-theme-apollo/blob/master/packages/gatsby-theme-apollo-docs/gatsby-node.js#L53 it's using
gatsby-plugin-printer
.I'm trying to use component shadowing to change the
social-card.js
file it's using here: https://github.com/apollographql/gatsby-theme-apollo/blob/master/packages/gatsby-theme-apollo-docs/gatsby-node.js#L53 but cannot get it to work. Shadowing regular react components does work.Is it because this resolve is sent to rollup? Chasing it down the rabbit hole here: https://github.com/ChristopherBiscardi/gatsby-plugins/blob/master/packages/gatsby-plugin-printer/gen-code-bundle.js#L46