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
Copy file name to clipboardExpand all lines: README.md
+6-4
Original file line number
Diff line number
Diff line change
@@ -351,7 +351,9 @@ Just remember to configure your `netlify.toml` to point to the `Next.js` build f
351
351
352
352
## Webpack Configuration
353
353
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).
355
357
356
358
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`.
357
359
@@ -383,7 +385,7 @@ The additional webpack config will be merged into the default config via [webpac
383
385
384
386
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).
385
387
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.
387
389
388
390
It is possible to disable this behaviour by passing `--babelrc false`.
You may also want to add `typescript @types/node @types/aws-lambda`.
403
405
404
-
2. Create a custom `.babelrc` file:
406
+
2. Create a Babel config file, e.g. `.babelrc`:
405
407
406
408
```diff
407
409
{
@@ -465,7 +467,7 @@ If you need an escape hatch and are building your lambda in some way that is inc
465
467
466
468
Defaults to `true`
467
469
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)
0 commit comments