Skip to content

Commit 3667a1c

Browse files
swyxioblkblihong
authored andcommitted
add config docs everywhere
closes netlify/netlify-lambda#110
1 parent d7ee2ec commit 3667a1c

File tree

1 file changed

+38
-2
lines changed

1 file changed

+38
-2
lines changed

Diff for: README.md

+38-2
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,19 @@ Obviously you need to run up `netlify-lambda` & `angular` at the same time.
190190

191191
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).
192192

193-
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`. See this issue for an example of [how to write a webpack override file](https://github.com/netlify/netlify-lambda/issues/64).
193+
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`.
194+
195+
For example, have a file with:
196+
197+
198+
```js
199+
// webpack.functions.js
200+
module.exports = {
201+
optimization: { minimize: false }
202+
};
203+
```
204+
205+
Then specify `netlify-lambda serve --config ./webpack.functions.js`. If using VSCode, it is likely that the `sourceMapPathOverrides` have to be adapted for breakpoints to work. Read here for more info on [how to modify the webpack config](https://github.com/netlify/netlify-lambda/issues/64#issuecomment-429625191).
194206

195207
The additional webpack config will be merged into the default config via [webpack-merge's](https://www.npmjs.com/package/webpack-merge) `merge.smart` method.
196208

@@ -249,6 +261,18 @@ There are additional CLI options:
249261

250262
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`.
251263

264+
For example, have a file with:
265+
266+
267+
```js
268+
// webpack.functions.js
269+
module.exports = {
270+
optimization: { minimize: false }
271+
};
272+
```
273+
274+
Then specify `netlify-lambda serve --config ./webpack.functions.js`.
275+
252276
### --port option
253277

254278
The serving port can be changed with the `-p`/`--port` option.
@@ -270,7 +294,19 @@ Minor note: For the `identity` field, since we are not fully emulating Netlify I
270294
To debug lambdas, you can use the `--inspect` flag. Additionally:
271295

272296
1. make sure that sourcemaps are built along the way (e.g. in the webpack configuration and the `tsconfig.json` if typescript is used)
273-
2. webpack's minification/uglification is turned off with `optimization: { minimize: false }`. If using VSCode, it is likely that the `sourceMapPathOverrides` have to be adapted for breakpoints to work. Read here for [how to modify the webpack config](https://github.com/netlify/netlify-lambda/issues/64#issuecomment-429625191).
297+
2. webpack's minification/uglification is turned off (see below):
298+
299+
For example, have a file with:
300+
301+
302+
```js
303+
// webpack.functions.js
304+
module.exports = {
305+
optimization: { minimize: false }
306+
};
307+
```
308+
309+
Then specify `netlify-lambda serve --config ./webpack.functions.js`. If using VSCode, it is likely that the `sourceMapPathOverrides` have to be adapted for breakpoints to work. Read here for more info on [how to modify the webpack config](https://github.com/netlify/netlify-lambda/issues/64#issuecomment-429625191).
274310

275311
Netlify Functions [run in Node v8.10](https://www.netlify.com/blog/2018/04/03/node.js-8.10-now-available-in-netlify-functions/) and you may need to run the same version to mirror the environment locally. Also make sure to check that you aren't [committing one of these common Node 8 mistakes in Lambda!](https://serverless.com/blog/common-node8-mistakes-in-lambda/)
276312

0 commit comments

Comments
 (0)