Gatsby Could Use a *Separate* (pre-gatsby-node.js) Way to Setup WebPack #26622
Unanswered
machineghost
asked this question in
Ideas / Feature Requests
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Summary
Right now you can only configure Webpack from within
gatsby-node.js
. But let's say you want to use some Webpack feature in that file: it's impossible.Basic example
For instance, let's say you want something extremely basic. Instead of wrapping a GraphQL query with:
and putting it into a
.js
file, you'd like to just be able to have a raw query string file:Webpack has a raw loader that let's you do exactly that (import a file's contents as a string) ... but it doesn't work with Gatsby, or at least not in
gatsby-node.js
itself. Why? Because it runs theimport
s in that file before that webpack config is ever set.Motivation
If I could just define the loader in some sort of
gatsby-webpack.js
file, somehow, then that file could get run beforehand. This would allow any webpack config that anyone might ever want (not just my loader, but any other loader, any path changes, etc.) to apply within the gatsby files (likegatsby-node
).Beta Was this translation helpful? Give feedback.
All reactions