Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Webpack serverless config
const webpack = require('webpack');
const path = require('path');
const config = require('./config');
module.exports = {
entry: {
login: path.join(__dirname, 'login', 'handler.js'),
email: path.join(__dirname, 'email', 'handler.js'),
graphql: path.join(__dirname, 'back', 'api', 'data', 'handler.js'),
resolve: {
root: path.resolve('.'),
extensions: ['', '.js'],
output: {
libraryTarget: 'commonjs',
path: path.join(__dirname, '.cache'),
filename: '[name].js',
chunkFilename: '[chunkhash].js',
target: 'node',
devtool: 'none',
debug: true,
externals: ['aws-sdk'],
module: {
loaders: [
test: /\.js$/,
loaders: ['babel'],
exclude: /node_modules/,
query: {
plugins: ['transform-runtime'],
babelrc: false,
presets: ['es2015', 'stage-0'],
test: /\.json$/,
loaders: ['json'],
include: __dirname,
plugins: [
new webpack.DefinePlugin({
__STAGE__: config.stage,
__REGION__: config.region,
new webpack.optimize.OccurrenceOrderPlugin(),
new webpack.optimize.AggressiveMergingPlugin(),
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment