question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Is there a good reason why `.babelrc` at the top directory is not a default way to customize `babel-loader` config?

See original GitHub issue

I mean, that’s probably something that would be expected by many, wouldn’t it? Especially considering that react-app-rewire-eslint enables .eslintrc support. Well, at least that’s something I was confused about initially myself

The only related thing I found is #83 but that’s more about Jest config. And it just seems weird to have it partially supported in some places but not the others and having to duplicate the same configuration options in two different places

What I’d like to propose is adding another function to the main package that would simillarly to injectBabelPlugin locate rules using babel-loader and switch babelrc option to true.
This way it will be both, explicit and backwards compatible

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:12 (10 by maintainers)

github_iconTop GitHub Comments

1reaction
unconfidentcommented, Aug 22, 2018

Just don’t and have everything you need in .babelrc like everyone else?

update: But I get your point. That said, if babelrc: true were to become a default in 2.0 I would prefer to not have babel-preset-react-app included in this “obscure” way and just have it specified in .babelrc instead with minimalistic loader configuration

1reaction
unconfidentcommented, Aug 22, 2018

This will behave slightly weird and possibly differently for CRA and Jest if you do it like this. Please see “protip” part of my comment from two weeks ago

tl;dr: you want to replace whole options object instead of modifying it

Read more comments on GitHub >

github_iconTop Results From Across the Web

Config Files - Babel.js
New in Babel 7.x, Babel has a concept of a "root" directory, which defaults to the current working directory. For project-wide configuration, Babel...
Read more >
why do I have to put babel-presets inside .babelrc and ...
No, this is not the case. Specifying the presets in the webpack config will only affect webpack, everything else that uses babel (e.g....
Read more >
Setting up Webpack, Babel and React from scratch, revisited
Let's create webpack.config.js in our project's root. ... Babel also has default config file which is .babelrc , so let's create it in...
Read more >
Setting up a NodeJS/Express Application with Babel - Medium
Mainly, the reason for using the babel is to make use of JavaScript new features in the code base. we don't know whether...
Read more >
babel-loader - webpack
Make sure you are transforming as few files as possible. Because you are probably matching /\.m?js$/ , you might be transforming the node_modules...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found