Expose Babel config for Gatsby
See original GitHub issueSummary
Exposing Gatsby’s Babel configuration would allow Gatsby apps to integrate with 3rd party tooling like linters and testing frameworks. There are two options for accomplishing this, making Gatsby’s config a babel preset, or printing a .babelrc file in root of project (or somewhere else).
Motivation
Currently getting testing or linting configuration requires essentially copying what Gatsby does into your own .babelrc
file, at this point it would be much cleaner and easier on the user to just install and include babel-preset-gatsby
.
Issue Analytics
- State:
- Created 5 years ago
- Reactions:25
- Comments:12 (10 by maintainers)
Top Results From Across the Web
Babel | Gatsby
Gatsby ships with a default .babelrc setup that should work for most sites. If you'd like to add custom Babel presets or plugins,...
Read more >Config Files - Babel.js
Babel can be configured using any file extension natively supported by Node.js, as mentioned in Configuration File Types section: babel.config.json and .babelrc ...
Read more >babel-preset-gatsby - npm
This package contains the default Babel setup for all Gatsby projects.. Latest version: 3.3.1, last published: 14 days ago.
Read more >Advanced Features: Customizing Babel Config - Next.js
Customizing Babel Config ... Next.js includes the next/babel preset to your app, which includes everything needed to compile React applications and server-side ...
Read more >Gatsby Changelog | 5.3.0
For many years, CommonJS (CJS) was the de facto standard in Node.js. Before now, gatsby-config and gatsby-node had to be written in CJS....
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Yeah, same here. Some tools require babel-config available like babel-plugin-react-intl. The same if I wanted to create my own tool that relies on babel and I don’t necessarily want it in my build system (by extending webpack config).
I see that most of examples and even documentation suggests copying specific presets and plugins. But this is less than optimal and more like a workaround I believe. It will make harder to migrate app to newer versions. Specifying packages in config that are not installed explicitly by user is also fragile I think.
What I would ideally see is something like they do in NextJS. If you want a custom .babelrc you create a file with a nextjs preset which has all that is necessary to work by a framework:
.babelrc
Yeah, I think it makes sense expose it as a preset so it’s really easy to configure with tooling. I hit issues with Storybook as well.