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

Improve serveless-webpack compatibility #26

Merged
merged 2 commits into from
Jul 1, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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.

21 changes: 21 additions & 0 deletions examples/serverless-webpack/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"name": "iopipe-layers-plugin-webpack-example",
"version": "0.0.0-test",
"description": "",
"main": "handler.js",
"scripts": {
"build": "yarn clean && yarn buildPlugin && yarn buildPackage",
"buildPackage": "LOCAL_PLUGIN=true SLS_DEBUG=* IOPIPE_TOKEN='test-token' sls package",
"buildPlugin": "cd ../../ && yarn build && mkdir -p examples/serverless-webpack/.serverless_plugins && cp -rf dist examples/serverless-webpack/.serverless_plugins/serverless-iopipe-layers",
"clean": "rm -rf .serverless_plugins",
"deploy": "yarn build && sls deploy"
},
"author": "",
"license": "ISC",
"devDependencies": {
"serverless": "^1.38.0",
"serverless-webpack": "^5.3.1",
"webpack": "^4.35.2"
},
"dependencies": {}
}
20 changes: 20 additions & 0 deletions examples/serverless-webpack/serverless.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
service: iopipe-layers-plugins-webpack-example

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

plugins:
- serverless-webpack
- serverless-iopipe-layers

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

functions:
handler:
handler: handler.handler
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