Created
September 13, 2018 07:41
-
-
Save kilgarenone/881bcd9cc557a00eee6cbb1de633b2b5 to your computer and use it in GitHub Desktop.
webpack babel in serverless
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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/, | |
}, | |
], | |
}, | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment