Unexpected Babel configuration behavior
See original GitHub issueThe babel config override will override the loaderOptions, presets, and plugins for both of the babel-loader
rules CRA has.
It seems like the second loader shouldn’t receive the presets and plugins by default, since the second loader is meant for:
// Process any JS outside of the app with Babel. // Unlike the application JS, we only compile the standard ES features.
I would argue the behavior is unexpected since only files in src/
are supposed to get babel-preset-react-app
and previously tools such as react-app-rewired
only modified the first loader
Issue Analytics
- State:
- Created 5 years ago
- Comments:7 (4 by maintainers)
Top Results From Across the Web
Unexpected Babel configuration behavior · Issue #36 - GitHub
My use case is a little out of the ordinary - I'm trying to package my whole toolkit with a customized craco config...
Read more >FAQ - Babel.js
Babel assumes that all input code is an ES2015 module. ES2015 modules are implicitly strict mode so this means that top-level this is...
Read more >Babel is examining the package.json of a target module for ...
Babel 6 was very aggressive about reading config files, which was an issue for exactly the reasons you are running into. Babel 7...
Read more >Babel - Storybook
Storybook's webpack config by default sets up Babel for ES6 transpiling. It has three different modes: CRA - the mode for Create React...
Read more >syntaxerror unexpected token export babel-jest - You.com
This happens e.g. when your code or its dependencies use non-standard JavaScript syntax, or when Jest is not configured to support such syntax....
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 FreeTop 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
Top GitHub Comments
Hi @d3dc
This is indeed an easy fix if you want to customize what’s being configured for the files outside of the
src/
directory.I might wait before updating any code for this one since I don’t want to break anyone setup.
How could craco’s configuration be modified to accommodate your usecase?
Maybe an
applyToExternalFiles
boolean option with a default value oftrue
? Not sure though if it wouldn’t be more confusing than helping?Will be fix in #49