babel.config.js not picked up since 2.13.30 (regression)
See original GitHub issueDescription
Since updating Gatsby to 2.13.30
(or newer), I can no longer use my own custom babel.config.js
. babel.config.js
is the new, better way to configure Babel. See Babel config files docs.
Steps to reproduce
I’ve created a minimal repro here: https://github.com/ahfarmer/gatsby-babel-config-issue
To create the repro I just ran gatsby new
, then added babel.config.js
and deleted some unnecessary files.
Here’s how you can reproduce easily:
git clone https://github.com/ahfarmer/gatsby-babel-config-issue
cd gatsby-babel-config-issue
yarn install
gatsby develop
Note that the console.log line that I have placed in babel.config.js
does NOT print out. There are other ways you could show that babel.config.js
is not being considered, but I think this is the easiest one.
Expected result
We should see this line printed to the console: "👍 babel.config.js is being used"
Actual result
babel.config.js
is not used for some reason. The code within does not run and the log statement doesn’t print out.
Workaround
yarn add gatsby@2.13.27
yarn develop
With this older version of Gatsby, you will see that babel.config.js
is being used.
Related Issues
Basically the same issue reported here: https://github.com/birkir/gatsby-source-graphql-universal/issues/3
I opened this issue to show that it is not an issue with gatsby-source-graphql-universal
, which I am not using.
They are reporting that this change caused the issue: https://github.com/gatsbyjs/gatsby/pull/15875
Environment
System:
OS: macOS 10.14.5
CPU: (4) x64 Intel(R) Core(TM) i5-7360U CPU @ 2.30GHz
Shell: 5.3 - /bin/zsh
Binaries:
Node: 10.15.3 - /usr/local/bin/node
Yarn: 1.17.3 - /usr/local/bin/yarn
npm: 6.4.1 - /usr/local/bin/npm
Languages:
Python: 3.6.8 - /anaconda3/bin/python
Browsers:
Chrome: 75.0.3770.142
Firefox: 68.0.1
Safari: 12.1.1
npmPackages:
gatsby: ^2.13.39 => 2.13.39
gatsby-image: ^2.2.6 => 2.2.6
gatsby-plugin-manifest: ^2.2.4 => 2.2.4
gatsby-plugin-offline: ^2.2.4 => 2.2.4
gatsby-plugin-react-helmet: ^3.1.2 => 3.1.2
gatsby-source-filesystem: ^2.1.6 => 2.1.6
npmGlobalPackages:
gatsby-cli: 2.7.17
Issue Analytics
- State:
- Created 4 years ago
- Comments:6 (6 by maintainers)
I disabled it because people should use .babelrc files instead. babel.config.js is used for library owners or in the root but shouldn’t be used on a project level.
https://babeljs.io/docs/en/config-files#project-wide-configuration
https://github.com/gatsbyjs/gatsby/pull/16205#issuecomment-516320418