-
Notifications
You must be signed in to change notification settings - Fork 10.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Modifying js babel loader #3052
Comments
On looking further into this, I can provide the necessary program properties manually. This seems to be nearly what I'm after, but the exclude seems to be ignored, am I doing anything obviously wrong? That
|
Forgot to return the promise! This is working now, hopefully someone else will find it useful:
|
Glad you figured it out! This looks like a great example -- could you add it to the docs? |
you can edit the parts of the babel loader directly without needing to generate an entire new |
@jquense Due to a bug introducd in gatsby 1.9.162, you actually cannot override the exclude on the js loader to load anything from node_modules because it merges your custom excludes to an array that excludes all of node_modules. Can confirm that this implementation works to resolve this issue, but it is kind of nasty. |
I'd like to modify the JS babel loader, so that I can tweak the excludes / includes and run the loader against some of my node_modules - I'm using some ES6 modules which allow this and will allow me to import only required parts of a library instead of whole bundled files.
I understand how to use
modifyWebpackConfig
in order to do this, but ideally I'd like to use Gatsby's own babelConfig generator rather than having to reproduce this. The trouble is this relies on theprogram
variable which doesn't seem to be accessible withingatsby-node.js
. Is this possible currently? Or would it be better to add some kind of configuration to allow tweaking of the include + exclude of the babel-loader?The text was updated successfully, but these errors were encountered: