serverless-webpack Cannot find module './node/NodeTemplatePlugin'

匿名 (未验证) 提交于 2019-12-03 01:00:01

问题:

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!

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!