Package Exports
- babel-preset-expo
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (babel-preset-expo) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
babel-preset-expo
If you have problems with the code in this repository, please file issues & bug reports at https://github.com/expo/expo. Thanks!
Options
lazyImports
Changes Babel's compiled import
statements to be lazily evaluated when their imported bindings are used for the first time.
Note: this option has an effect only when the disableImportExportTransform
option is set to false
. On Android and iOS, disableImportExportTransform
defaults to false
, and on web it defaults to true
to allow for tree shaking.
This can improve the initial load time of your app because evaluating dependencies up front is sometimes entirely un-necessary, particularly when the dependencies have no side effects.
The value of lazyImports
has a few possible effects:
null
- metro-react-native-babel-preset will handle it. (Learn more about it here: https://github.com/facebook/metro/commit/23e3503dde5f914f3e642ef214f508d0a699851d)false
- No lazy initialization of any imported module.true
- Lazy-init all imported modules except local imports (e.g.,./foo
), certain Expo packages that have side effects, and the two cases mentioned here.Array<string>
- babel-plugin-transform-modules-commonjs will handle it.(string) => boolean
- babel-plugin-transform-modules-commonjs will handle it.If you choose to do this, you can also access the list of Expo packages that have side effects by using
const lazyImportsBlacklist = require('babel-preset-expo/lazy-imports-blacklist');
which returns aSet
.
default: null
[
'babel-preset-expo',
{
lazyImports: true
}
],
web.disableImportExportTransform
Enabling this option will allow your project to run with older JavaScript syntax (i.e. module.exports
). This option will break tree shaking and increase your bundle size, but will eliminate the following error when module.exports
is used:
TypeError: Cannot assign to read only property 'exports' of object '#<Object>'
default: false
[
'babel-preset-expo',
{
web: { disableImportExportTransform: true }
}
],