Skip to content
This repository has been archived by the owner on Mar 27, 2020. It is now read-only.

Commit

Permalink
Improve serverless-webpack compatibility
Browse files Browse the repository at this point in the history
* Checks that the plugin order is correct if `serverless-webpack` is present
* Adds aserverless-webpack example
* Renames `iopipe_wrapper.js` to `iopipe-wrapper.js`
* Updates README to add serverless-webpack caveats/recommendations

Closes #19
Closes #25
  • Loading branch information
kolanos committed Jul 1, 2019
1 parent 6479b62 commit d6978ed
Show file tree
Hide file tree
Showing 9 changed files with 1,456 additions and 91 deletions.
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,10 @@ This plugin currently supports the following AWS runtimes:
* python3.6
* python3.7

### Using with serverless-webpack

When using with [serverless-webpack](https://github.com/serverless-heaven/serverless-webpack) it is highly recommended to use the `nodejs10.x` runtime as this runtime does not require a helper script. For earlier Node.js runtimes a helper script is required which must be included via your `webpack.config.js`. The `serveless-iopipe-layers` plugin must follow the `serverless-webpack` plugin in your `serverless.yml`. See [here](https://github.com/iopipe/serverless-iopipe-layers/tree/master/examples/serverless-webpack) for an example.

## Limitations

* Doesn't currently support local invocation
Expand Down
1 change: 1 addition & 0 deletions examples/serverless-webpack/.webpack/service/handler.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion examples/serverless-webpack/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@
"license": "ISC",
"devDependencies": {
"serverless": "^1.38.0",
"serverless-webpack": "^5.3.1"
"serverless-webpack": "^5.3.1",
"webpack": "^4.35.2"
},
"dependencies": {}
}
59 changes: 5 additions & 54 deletions examples/serverless-webpack/serverless.yml
Original file line number Diff line number Diff line change
@@ -1,69 +1,20 @@
service: iopipe-layers-plugin-example
service: iopipe-layers-plugins-webpack-example

provider:
name: aws
stage: prod
region: us-east-1
runtime: nodejs10.x

plugins:
- serverless-iopipe-layers/index.js
- serverless-webpack
- serverless-iopipe-layers

custom:
iopipe:
debug: true
token: ${env:IOPIPE_TOKEN}

functions:
layer-nodejs610:
handler:
handler: handler.handler
package:
exclude:
- ./**
include:
- handler.js
runtime: nodejs6.10

layer-nodejs810:
handler: handler.handler
package:
exclude:
- ./**
include:
- handler.js
runtime: nodejs8.10

layer-nodejs10:
handler: handler.handler
package:
exclude:
- ./**
include:
- handler.js
runtime: nodejs10.x

layer-python27:
handler: handler.handler
package:
exclude:
- ./**
include:
- handler.py
runtime: python2.7

layer-python36:
handler: handler.handler
package:
exclude:
- ./**
include:
- handler.py
runtime: python3.6

layer-python37:
handler: handler.handler
package:
exclude:
- ./**
include:
- handler.py
runtime: python3.7
6 changes: 6 additions & 0 deletions examples/serverless-webpack/webpack.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
const slsw = require('serverless-webpack');

module.exports = {
entry: slsw.lib.entries,
target: 'node'
};
Loading

0 comments on commit d6978ed

Please sign in to comment.