Coding With Fun
Home Docker Django Node.js Articles Python pip guide FAQ Policy

When to use babel preset expo or babel-preset-expo?


Asked by Lauryn Richard on Dec 03, 2021 FAQ



If you start your web project with @expo/webpack-config or expo start:web and your project doesn't contain a babel.config.js or a .babelrc then it will default to using babel-preset-expo for loading. If you have problems with the code in this repository, please file issues & bug reports at https://github.com/expo/expo.
Furthermore,
But there is a solution to this: presets! The Babel foundation has created presets that contains common bundles of plugins. That means you only have to do the NPM installation and babel configuration once and then a bunch of plugins are automatically installed for you.
Besides, Expo init is creating a babel.config.js for you. Just add the plugins key to your babel.config.js file and add your alias. The env key is not needed anymore.
Also Know,
This preset extends the default React Native preset ( metro-react-native-babel-preset) and adds support for decorators, tree-shaking web packages, and loading font icons with optional native dependencies if they're installed. You can use this preset in any React Native project as a drop-in replacement for metro-react-native-babel-preset.
In addition,
A bundler property denoting the name of the bundler that is being used to create the JavaScript bundle. If the bundler is not defined, it will default to checking if a babel-loader is used, if so then webpack will be used, otherwise it will default to metro.