To be clear, this works fine when gatsby-cli is run from the site modules (./node_modules/.bin/gatsby) and does not when a globally installed gatsby-cli is run. I did some digging and this is because require.main (which is what is used before this PR) is an instance of Module with paths set relative to the globally installed binary versus (correctly) being relative to the site's folder (where webpack is indeed installed)
I wasn't sure why this was added and wanted to open this and discuss this!
What is the new behavior (if this is a feature change)?
What kind of change does this PR introduce? (bugfix, feature, docs update, improvement)
bugfix
What is the current behavior? (You can also link to an open issue here)
Hello! Gatsby core team maintainer here 🙂
The plugin breaks when used with gatsby and gatsby-plugin-svg-sprite-loader
To be clear, this works fine when
gatsby-cli
is run from the site modules (./node_modules/.bin/gatsby) and does not when a globally installedgatsby-cli
is run. I did some digging and this is becauserequire.main
(which is what is used before this PR) is an instance of Module with paths set relative to the globally installed binary versus (correctly) being relative to the site's folder (where webpack is indeed installed)I wasn't sure why this was added and wanted to open this and discuss this!
What is the new behavior (if this is a feature change)?
This seems to be resolved with this change
Does this PR introduce a breaking change?
No
Please check if the PR fulfills contributing guidelines