Skip to content

Commit 2404593

Browse files
authored
Update README.md
1 parent 2ea4d3c commit 2404593

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

Diff for: README.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -421,12 +421,12 @@ Minor note: For the `identity` field, since we are not fully emulating Netlify I
421421

422422
## Debugging
423423

424-
To debug lambdas, you can use the `--inspect` flag. Additionally:
424+
To debug lambdas, prepend the `serve` command with [npm's package runner npx](https://medium.com/@maybekatz/introducing-npx-an-npm-package-runner-55f7d4bd282b), e.g. `npx --node-arg=--inspect netlify-lambda serve ...`.
425425

426426
1. make sure that sourcemaps are built along the way (e.g. in the webpack configuration and the `tsconfig.json` if typescript is used)
427427
2. webpack's minification/uglification is turned off (see below):
428428

429-
For example, have a file with:
429+
For example, to customize the webpack config you can have a file with:
430430

431431
```js
432432
// webpack.functions.js
@@ -435,7 +435,7 @@ module.exports = {
435435
};
436436
```
437437

438-
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).
438+
So you can run something like `npx --node-arg=--inspect 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).
439439

440440
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/)
441441

0 commit comments

Comments
 (0)