Skip to content

Commit 9a6f77b

Browse files
danezklavavej
andauthored
Apply suggestions from code review
Co-authored-by: Kristen Lavavej <35638702+klavavej@users.noreply.github.com>
1 parent 89b04c4 commit 9a6f77b

File tree

1 file changed

+22
-15
lines changed

1 file changed

+22
-15
lines changed

MIGRATE.md

Lines changed: 22 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,24 @@
11
# Migration Guide
22

3-
This guide covers some use cases of netlify-lambda and how to accomplish them without it.
3+
This guide covers the following use cases of netlify-lambda and how to accomplish them without this deprecated tool.
44

5-
## Running Netlify functions locally
5+
- [Run Netlify functions locally](#run-netlify-functions-locally)
6+
- [Use Typescript or non-standard JavaScript features](#use-typescript-or-non-standard-javascript-features)
7+
- [Bundle with Webpack](#bundle-with-webpack)
8+
- [Install function dependencies](#install-function-dependencies)
69

7-
The functionality to have functions run locally has been completely integrated into the Netlify CLI and offers even more functionality like local debugging.
810

9-
If you had `netlify-lambda` in you npm scripts you can simply migrate by changing to the Netlify CLIs `dev` command.
11+
## Run Netlify Functions locally
12+
13+
The tooling to run functions locally has been completely integrated into the Netlify CLI, which offers even more functionality like local debugging.
14+
15+
If you had `netlify-lambda` in your npm scripts, you can migrate by changing to the Netlify CLI `dev` command.
1016

1117
For example in a theoretical Gatsby project you can migrate with the following changes:
1218

19+
> package.json
20+
21+
1322
```diff
1423
{
1524
"scripts": {
@@ -26,19 +35,17 @@ For example in a theoretical Gatsby project you can migrate with the following c
2635
}
2736
```
2837

29-
## Using Typescript or non-standard JavaScript features
30-
31-
Netlify now also supports Typescript and non-standard JavaScript features.
32-
For Typescript there is no configuration needed and tit will work out of the box. The same is true if you use ESM modules in your functions. The bundling logic will automatically detect this and use `esbuild` to bundle the function.
33-
In any other case you can enable set the `node_bundler` to `esbuild` yourself for the functions in your `netlify.toml` file. https://docs.netlify.com/configure-builds/file-based-configuration/#functions
38+
## Use TypeScript or non-standard JavaScript features
3439

35-
Should `esbuild` not work for you usecase then please report this to us or use webpack directly. You can check how this works in the next section.
40+
Netlify now supports TypeScript and non-standard JavaScript features.
41+
For TypeScript there is no configuration needed and it will work out of the box. The same is true if you use ESM modules in your functions. The bundling logic will automatically detect these and use `esbuild` to bundle the functions.
42+
In any other case you can set the `node_bundler` to `esbuild` yourself for the functions in your `netlify.toml` file. https://docs.netlify.com/configure-builds/file-based-configuration/#functions
3643

37-
## Webpack bundling
44+
Should `esbuild` not work for your use case then please report this to us or use webpack directly as described in the next section.
3845

39-
You might want to give our automated bundling a try (see above).
46+
## Bundle with Webpack
4047

41-
If you still want to use webpack to bundle your functions, you can simply use webpack yourself and adjust the following config to your needs. This example is for webpack 4, which is the version that netlify-lambda also used.
48+
If after trying our [automated bundling](#use-typescript-or-non-standard-javascript-features) you still want to use webpack to bundle your functions, you can use webpack directly and adjust the config to your needs. The following example is for webpack 4, which is the version that netlify-lambda used.
4249

4350
> package.json
4451
@@ -111,9 +118,9 @@ module.exports = {
111118

112119
## Install function dependencies
113120

114-
Consider moving the dependencies of your functions into your main `package.json`. If this is not possible you can use the following change.
121+
Consider moving the dependencies of your functions into your main `package.json` for automatic installation during local development. If this is not possible you can use the following change.
115122

116-
Note that, this is only needed for local development, the Netlify Build System will detect and install dependencies of your functions.
123+
Note that this is needed for local development only. The Netlify build system will detect and install dependencies of your functions.
117124

118125
```diff
119126
{

0 commit comments

Comments
 (0)