You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -144,16 +143,20 @@ Enable compiling source files with Babel and use commonjs module system.
144
143
145
144
This is useful for running the code in Node (SSR, tests etc.). The output file should be referenced in the `main` field of `package.json`.
146
145
147
-
By default, this will compile the code for last 2 versions of modern browsers, as well as JSX. It'll also strip TypeScript and Flow annotations. You can customize the environments to compile for by using a [browserslist config](https://github.com/browserslist/browserslist#config-file). To customize the babel config used, you can pass the [`configFile`](https://babeljs.io/docs/en/options#configfile) or [`babelrc`](https://babeljs.io/docs/en/options#babelrc) options.
146
+
By default, the code is compiled to support last 2 versions of modern browsers. It also strips TypeScript and Flow annotations, and compiles JSX. You can customize the environments to compile for by using a [browserslist config](https://github.com/browserslist/browserslist#config-file).
148
147
149
-
If your source code is written in [Flow](http://www.typescriptlang.org/), You can also specify the `copyFlow` option to copy the source files as `.js.flow` to the output folder. If the `main` entry in `package.json` points to the `index` file in the output folder, the flow type checker will pick these files up to use for type definitions.
148
+
In addition, the following options are supported:
150
149
151
-
By default, sourcemaps are generated alongside the compiled files. You can disable them by setting the `sourceMaps` option to `false`.
150
+
-`configFile` & `babelrc` (`boolean`): To customize the babel config used, you can pass the [`configFile`](https://babeljs.io/docs/en/options#configfile) option as `true` if you have a `babel.config.js` or [`babelrc`](https://babeljs.io/docs/en/options#babelrc) option if you have a `.babelrc`. This may break the default configuration, so use these options only if you know what you're doing.
151
+
152
+
-`copyFlow` (`boolean`): If your source code is written in [Flow](http://www.typescriptlang.org/), You can specify the `copyFlow` option to copy the source files as `.js.flow` to the output folder. If the `main` entry in `package.json` points to the `index` file in the output folder, the flow type checker will pick these files up to use for type definitions.
153
+
154
+
-`sourceMaps` (`boolean`): Sourcemaps are generated by default alongside the compiled files. You can disable them by setting the `sourceMaps` option to `false`.
@@ -165,14 +168,18 @@ This is useful for bundlers which understand ES modules and can tree-shake. The
165
168
Example:
166
169
167
170
```json
168
-
["module", { "babelrc": true, "copyFlow": true }]
171
+
["module", { "configFile": true }]
169
172
```
170
173
171
174
##### `typescript`
172
175
173
176
Enable generating type definitions with `tsc` if your source code is written in [TypeScript](http://www.typescriptlang.org/).
174
177
175
-
By default, it'll use the `tsconfig.json` file in your project root. If you want to use a different config, you can specify it using the `project` option. Furthermore, the tsc binary will be resolved to ./node_modules/.bin/tsc. Use the `tsc` option to specify a different path.
178
+
The following options are supported:
179
+
180
+
-`project` (`string`): By default, the `tsconfig.json` file in the root of your project is used to generate the type definitions. You can specify a path to a different config by using the `project` option. This can be useful if you need to use different configs for development and production.
181
+
182
+
-`tsc` (`string`): The path to the `tsc` binary is automatically detected and defaults to the one installed in your project. You can use the `tsc` option to specify a different path.
176
183
177
184
Example:
178
185
@@ -184,9 +191,14 @@ Example:
184
191
185
192
Enable assembling Android AAR files for a library for React Native modules including native code.
186
193
187
-
It's also possible to convert the AAR with the `reverseJetify` option to use the [Android support Library](https://developer.android.com/topic/libraries/support-library) using the [`jetifier`](https://www.npmjs.com/package/jetifier) package if your package is using [AndroidX](https://developer.android.com/jetpack/androidx). This is useful to publish packages for older projects which haven't migrated to AndroidX.
194
+
The following options are supported:
195
+
196
+
-`reverseJetify` (`boolean`): If your package is using [AndroidX](https://developer.android.com/jetpack/androidx), it's possible to convert the AAR with the `reverseJetify` option to use the [Android support Library](https://developer.android.com/topic/libraries/support-library) using the [`jetifier`](https://www.npmjs.com/package/jetifier) package. This is useful to publish packages for older projects which haven't migrated to AndroidX.
197
+
198
+
-`androidPath` (`string`): You can specify a custom path to the `android` directory if it's not in the default location (`android` in the root of your project).
199
+
200
+
-`androidBundleName`: By default, the generated `aar` file is named as `android.aar`. You can specify a custom name using this option.
188
201
189
-
You can also specify the `androidPath` (defaults to `android`) to specify the `android` directory and `androidBundleName` (defaults to `android.aar`) to customize the name of AAR file.
190
202
Example:
191
203
192
204
```json
@@ -215,16 +227,6 @@ This builds the project according to the configuration. This is usually run as p
215
227
}
216
228
```
217
229
218
-
#### `run`
219
-
220
-
This runs a script either with `npm` or `yarn` depending on the command that was used to run `bob`. If the script doesn't exist under the `scripts` section in `package.json`, then it's forwarded to `npm` or `yarn`. This is useful for using inside `package.json` scripts to avoid coupling them with a specific package manager.
221
-
222
-
```json
223
-
"scripts": {
224
-
"bootstrap": "bob run install && bob run --cwd example pods"
225
-
}
226
-
```
227
-
228
230
## FAQ
229
231
230
232
### Why should I compile my project with `react-native-builder-bob`?
0 commit comments