From c6d266386be88e4ac24174f9497c947cb8f55a27 Mon Sep 17 00:00:00 2001 From: Ollie Monk Date: Fri, 17 May 2019 13:37:00 +0800 Subject: [PATCH] update readme --- README.md | 11 ++++++++++- bin/cmd.js | 2 +- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 5d450d62..ada70705 100644 --- a/README.md +++ b/README.md @@ -347,7 +347,9 @@ The additional webpack config will be merged into the default config via [webpac 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). -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. +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. + +It is possible to disable this behaviour by passing `--babelrc false`. If you need to run different babel versions for your lambda and for your app, [check this issue](https://github.com/netlify/netlify-lambda/issues/34) to override your webpack babel-loader. @@ -393,6 +395,7 @@ There are additional CLI options: -p --port -s --static -t --timeout +-b --babelrc ``` ### --config option @@ -422,6 +425,12 @@ The serving port can be changed with the `-p`/`--port` option. If you need an escape hatch and are building your lambda in some way that is incompatible with our build process, you can skip the build with the `-s` or `--static` flag. [More info here](https://github.com/netlify/netlify-lambda/pull/62). +### --babelrc + +Defaults to `true` + +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) + ## Netlify Identity Make sure to [read the docs](https://www.netlify.com/docs/functions/#identity-and-functions) on how Netlify Functions and Netlify Identity work together. Basically you have to make your request with an `authorization` header and a `Bearer` token with your Netlify Identity JWT supplied. You can get this JWT from any of our Identity solutions from [gotrue-js](https://github.com/netlify/gotrue-js) to [netlify-identity-widget](https://github.com/netlify/netlify-identity-widget). diff --git a/bin/cmd.js b/bin/cmd.js index 5518c6af..23ff5298 100755 --- a/bin/cmd.js +++ b/bin/cmd.js @@ -26,7 +26,7 @@ const stringBooleanToBoolean = val => { program .option("-c --config ", "additional webpack configuration") .option("-p --port ", "port to serve from (default: 9000)") - .option("-b --babelrc ", "use .babelrc in root (default: true)", stringBooleanToBoolean) + .option("-b --babelrc babelrc>", "use .babelrc in root (default: true)", stringBooleanToBoolean) .option( "-t --timeout ", "function invocation timeout in seconds (default: 10)"