Skip to content

Commit 2b05775

Browse files
committed
docs: update README on usage of Babel config files
1 parent f913a20 commit 2b05775

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

README.md

+6-4
Original file line numberDiff line numberDiff line change
@@ -351,7 +351,9 @@ Just remember to configure your `netlify.toml` to point to the `Next.js` build f
351351

352352
## Webpack Configuration
353353

354-
By default the webpack configuration uses `babel-loader` to load all js files. Any `.babelrc` in the directory `netlify-lambda` is run from will be respected. If no `.babelrc` is found, a [few basic settings are used](https://github.com/netlify/netlify-lambda/blob/master/lib/build.js#L11-L15a).
354+
By default the webpack configuration uses `babel-loader` to load all js files.
355+
`netlify-lambda` will search for [a valid babel config file](https://babeljs.io/docs/en/config-files) in the functions directory first and look upwards up to the directory `netlify-lambda` is run from (similar to how `babel-loader` looks for a Babel config file).
356+
If no babel config file is found, a [few basic settings are used](https://github.com/netlify/netlify-lambda/blob/master/lib/build.js#L11-L15a).
355357

356358
If you need to use additional webpack modules or loaders, you can specify an additional webpack config with the `-c`/`--config` option when running either `serve` or `build`.
357359

@@ -383,7 +385,7 @@ The additional webpack config will be merged into the default config via [webpac
383385

384386
The default webpack configuration uses `babel-loader` with a [few basic settings](https://github.com/netlify/netlify-lambda/blob/master/lib/build.js#L19-L33).
385387

386-
However, if any `.babelrc` is found in the directory `netlify-lambda` is run from, or [folders above it](https://github.com/netlify/netlify-lambda/pull/92) (useful for monorepos), it will be used instead of the default one.
388+
However, if any valid Babel config file is found in the directory `netlify-lambda` is run from, or [folders above it](https://github.com/netlify/netlify-lambda/pull/92) (useful for monorepos), it will be used instead of the default one.
387389

388390
It is possible to disable this behaviour by passing `--babelrc false`.
389391

@@ -401,7 +403,7 @@ npm install --save-dev @babel/preset-typescript
401403

402404
You may also want to add `typescript @types/node @types/aws-lambda`.
403405

404-
2. Create a custom `.babelrc` file:
406+
2. Create a Babel config file, e.g. `.babelrc`:
405407

406408
```diff
407409
{
@@ -465,7 +467,7 @@ If you need an escape hatch and are building your lambda in some way that is inc
465467

466468
Defaults to `true`
467469

468-
Use a `.babelrc` found in the directory `netlify-lambda` is run from. This can be useful when you have conflicting babel-presets, more info [here](#babel-configuration)
470+
Use a Babel config file found in the directory `netlify-lambda` is run from. This can be useful when you have conflicting babel-presets, more info [here](#babel-configuration)
469471

470472
## Netlify Identity
471473

0 commit comments

Comments
 (0)