I am using below dependencies and it works fine with sls offline. but when I try to deploy to aws lambda it gives me an Error: ENOENT: no such file or directory, lstat ‘{path_to_dir}/.webpack/.serverless’
.serverless dir is created to ‘{path_to_dir}/.serverless’
“dependencies”: {
“serverless-offline”: “^3.15.3”,
“serverless-webpack”: “^2.2.2”,
“webpack”: “^3.5.5”,
“webpack-node-externals”: “^1.6.0”
}
My webpack.conf.js is as below
var nodeExternals = require(‘webpack-node-externals’);
module.exports = {
entry: './handler.js',
// context: __dirname,
node: {
process:true,
__filename: true,
__dirname: true
},
target: 'node',
module: {
loaders: []
},
// output: {
// libraryTarget: 'commonjs',
// path: '.webpack',
// filename: 'handler.js', // this should match the first part of function handler in serverless.yml
// },
externals: [nodeExternals()],
};