Skip to content

Instantly share code, notes, and snippets.

@supachris28
Created June 25, 2019 11:28
Show Gist options
  • Save supachris28/994fee06c48e627a1424eeeea849f216 to your computer and use it in GitHub Desktop.
Save supachris28/994fee06c48e627a1424eeeea849f216 to your computer and use it in GitHub Desktop.
const slsw = require('serverless-webpack');
const path = require('path');
const nodeExternals = require('webpack-node-externals');
module.exports = {
entry: slsw.lib.entries, // important
target: 'node',
mode: 'production',
devtool: 'source-map', // important
externals: [nodeExternals()],
module: {
rules: [
{
test: /\.js$/,
exclude: /node_modules/,
use: [
{
loader: 'babel-loader',
},
],
},
],
},
output: { // important
libraryTarget: 'commonjs',
path: path.join(__dirname, '.webpack'),
filename: '[name].js',
sourceMapFilename: '[file].map',
},
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment