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
+38-2
Original file line number
Diff line number
Diff line change
@@ -190,7 +190,19 @@ Obviously you need to run up `netlify-lambda` & `angular` at the same time.
190
190
191
191
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).
192
192
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).
194
206
195
207
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.
196
208
@@ -249,6 +261,18 @@ There are additional CLI options:
249
261
250
262
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`.
251
263
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
+
252
276
### --port option
253
277
254
278
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
270
294
To debug lambdas, you can use the `--inspect` flag. Additionally:
271
295
272
296
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).
274
310
275
311
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/)
0 commit comments