Skip to content

Commit b851f57

Browse files
committed
Upgrading to serverless-webpack 3
1 parent c8e46c1 commit b851f57

File tree

4 files changed

+1774
-576
lines changed

4 files changed

+1774
-576
lines changed

README.md

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ This uses the [serverless-webpack](https://github.com/elastic-coders/serverless-
66

77
- **ES7 syntax in your handler functions**
88
- Use async/await
9-
- The spread operator
109
- And much more!
1110
- **Sourcemaps for proper error messages**
1211
- Error message show the correct line numbers
@@ -20,7 +19,7 @@ If you'd like to learn how to setup your existing Serverless project to support
2019

2120
### Demo
2221

23-
A demo version of this service is hosted on AWS - [`https://ndgmy14knc.execute-api.us-east-1.amazonaws.com/dev/hello`](https://ndgmy14knc.execute-api.us-east-1.amazonaws.com/dev/hello)
22+
A demo version of this service is hosted on AWS - [`https://ndgmy14knc.execute-api.us-east-1.amazonaws.com/dev/hello`](https://2njfspcvna.execute-api.us-east-1.amazonaws.com/dev/hello)
2423

2524
And here is the ES7 source behind it
2625

@@ -74,22 +73,28 @@ $ npm install
7473
To run a function on your local
7574

7675
``` bash
77-
$ serverless webpack invoke --function hello
76+
$ serverless invoke local --function hello
7877
```
7978

80-
And to deploy
79+
Deploy your project
8180

8281
``` bash
8382
$ serverless deploy
8483
```
8584

85+
Deploy a single function
86+
87+
``` bash
88+
$ serverless deploy function --function hello
89+
```
90+
8691
To add another function as a new file to your project, simply add the new file and add the reference to `serverless.yml`. The `webpack.config.js` automatically handles functions in different files.
8792

8893
### How It Works
8994

9095
To ensure that you get all the ES7 capabilities while showing proper error messages and seamlessly integrating with the rest of your project, we do the following:
9196

92-
- The `webpack.config.js` loads all your handlers from the `serverless.yml` and transpiles them using Babel. This means that you don't have to edit the `webpack.config.js` when you add a new handler file.
97+
- The `webpack.config.js` loads all your handlers using the `slsw.lib.entries` from the serverless-webpack plugin. This means that you don't have to edit the `webpack.config.js` when you add a new handler file.
9398
- Generate the sourcemaps for all the transpiled files and load the sourcemaps in each of the handler files.
9499
- Catch and log any unhandled exceptions to ensure that async functions can log errors.
95100

0 commit comments

Comments
 (0)