I'm trying to use the serverless-webpack plugin, and while running webpack alone works just fine, attempting to run serverless-webpack fails with Cannot find module './node/NodeTemplatePlugin'
.
My serverless.yml file is as follows:
service: kamehameha
provider:
name: aws
runtime: nodejs6.10
functions:
getDeltas:
handler: bundle.getDeltas
plugins:
- serverless-webpack
And my webpack config is as follows:
let path = require("path")
let webpack = require("webpack")
let nodeExternals = require("webpack-node-externals")
module.exports = {
entry: "./src/index.re",
target: "node",
node: {
__dirname: true,
},
externals: [nodeExternals()],
output: {
path: __dirname,
filename: "bundle.js",
},
module: {
loaders: [
{
test: /\.re$/,
loader: "bs-loader",
},
],
},
resolve: {
extensions: [".re", ".ml", ".js"],
},
}
Webpack alone compiles the reason file into bundle.js, however serverless-webpack runs with the aforemention error.
I'm trying to use the plugin because compiling and deploying alone causes a lambda error where it cannot find the handler.
I've tried removing the global webpack installation and using only the local one, as well as with serverless. Has anyone encountered something similar?
Thanks!