Okay.
My babelrc file looks like this:
{
"plugins": ["source-map-support", "transform-runtime"],
"presets": [
["env", { "node": "8.10" }],
"stage-3"
]
}
My webpack.config.js:
const slsw = require("serverless-webpack");
const nodeExternals = require("webpack-node-externals");
module.exports = {
entry: slsw.lib.entries,
target: "node",
// Generate sourcemaps for proper error messages
devtool: 'source-map',
// Since 'aws-sdk' is not compatible with webpack,
// we exclude all node dependencies
externals: [nodeExternals()],
mode: slsw.lib.webpack.isLocal ? "development" : "production",
optimization: {
// We no not want to minimize our code.
minimize: false
},
performance: {
// Turn off size warnings for entry points
hints: false
},
// Run babel on all .js files and skip those in node_modules
module: {
rules: [
{
test: /\.js$/,
loader: "babel-loader",
include: __dirname,
exclude: /node_modules/
}
]
}
};
And my package.json has the following dependencies:
"devDependencies": {
"aws-sdk": "^2.224.1",
"babel-core": "^6.26.0",
"babel-loader": "^7.1.4",
"babel-plugin-source-map-support": "^1.0.0",
"babel-plugin-transform-runtime": "^6.23.0",
"babel-preset-env": "^1.6.1",
"babel-preset-stage-3": "^6.24.1",
"jest": "^21.2.1",
"serverless-offline": "^3.18.0",
"serverless-webpack": "^5.1.0",
"webpack": "^4.2.0",
"webpack-node-externals": "^1.6.0"
},
"dependencies": {
"babel-runtime": "^6.26.0",
"source-map-support": "^0.4.18",
"stripe": "^5.8.0",
"uuid": "^3.2.1"
}
}
If I add this:
# Use serverless-webpack plugin to transpile ES6/ES7
plugins:
- serverless-webpack
To my serverless.yml, I get an error when deploying:
The webpack plugin could not find the configuration file at: /tmp/seed/source/services/notes/webpack.config.js
But thats not an valid path either, I dont have an webpack.config.js in each of my service folders, have have one at /tmp/seed/source/services
Any idea how to fix this?
Kind regards.