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
Looking for some ideas of how to better solve our issue when developing our react-component lib while working in Gatsby.
This is what we are doing now...
gatsby-node.js
if(!process.env.CI){// TODO: only do this on local development. Source: https://github.com/facebook/react/issues/13991#issuecomment-435587809constPEER_DEPENDENCIES=require('./node_modules/@our-company/react-components/package.json').peerDependencies// NOTE: we don't wanna do this for many packages though... need a better solution long-term.constdevAliases=Object.keys(PEER_DEPENDENCIES).reduce((acc,current)=>{return{
...acc,[current]: path.resolve(`./node_modules/${current}`),}},{})devAliasesOrEmptyObj=devAliases}actions.setWebpackConfig({resolve: {alias: {
...devAliasesOrEmptyObj,},},})
This is to avoid issues with:
having the lib dev lints complaining that the modules do not exist, if you choose not to install peerdeps also as devdeps.
having gatsby site error out in that we're implementing the lib in (while yarn link'n) This seems to happen due to it either loading two versions of modules or missing deps of lib do to our lib hoisting up out of view. (lerna)
...since Gatsby v3 the above solve no longer works for @reach/router and somehow is causing its Location component not to work
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.
-
Looking for some ideas of how to better solve our issue when developing our react-component lib while working in Gatsby.
This is what we are doing now...
gatsby-node.js
This is to avoid issues with:
yarn link
'n) This seems to happen due to it either loading two versions of modules or missing deps of lib do to our lib hoisting up out of view. (lerna)...since Gatsby v3 the above solve no longer works for @reach/router and somehow is causing its
Location
component not to workBeta Was this translation helpful? Give feedback.
All reactions