You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We are having a problem similar to this one I think.
We have an internal UI package lib that we're trying to bake in some gatsby GraphQL queries into, to be compiled and removed by the consuming gatsby projects. However, we're getting the error:
It appears like Gatsby is misconfigured. Gatsby related graphql calls are supposed to only be evaluated at compile time, and then compiled away. Unfortunately, something went wrong and the query was left in the compiled code. Unless your site has a complex or custom babel/Gatsby configuration this is likely a bug in Gatsby.
Is there a way to setup the consuming project's gatsby config to specifically target our repo with babel-remove-graphql-queries? From the issue above, it sounds like by default packages with gatsby-* prefex are targeted.
I've tried whitelisting our package with onCreateWebpackConfig but with no luck...
exports.onCreateWebpackConfig=({ actions, loaders, stage, getConfig })=>{constconfig=getConfig()config.module.rules=[// Omit the default rule where test === '\.jsx?$'
...config.module.rules.filter((rule)=>String(rule.test)!==String(/\.jsx?$/)),// Recreate it with custom exclude filter{// Called without any arguments, `loaders.js()` will return an// object like:// {// options: undefined,// loader: '/path/to/node_modules/gatsby/dist/utils/babel-loader.js',// }// Unless you're replacing Babel with a different transpiler, you probably// want this so that Gatsby will apply its required Babel// presets/plugins. This will also merge in your configuration from// `babel.config.js`.
...loaders.js(),test: /\.jsx?$/,// Exclude all node_modules from transpilation, except for '@klickmarketing/react-components'exclude: (modulePath)=>/node_modules/.test(modulePath)&&!/node_modules\/(OUR_PACKAGE_NAME)/.test(modulePath),},]actions.replaceWebpackConfig(config)
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
We are having a problem similar to this one I think.
We have an internal UI package lib that we're trying to bake in some gatsby GraphQL queries into, to be compiled and removed by the consuming gatsby projects. However, we're getting the error:
Is there a way to setup the consuming project's gatsby config to specifically target our repo with
babel-remove-graphql-queries
? From the issue above, it sounds like by default packages withgatsby-*
prefex are targeted.I've tried whitelisting our package with
onCreateWebpackConfig
but with no luck...I'm still getting the same error though.
Beta Was this translation helpful? Give feedback.
All reactions