Created
September 4, 2016 07:31
-
-
Save nirnanaaa/d7f40deb38f1cf7f931dc7ef0c582bf0 to your computer and use it in GitHub Desktop.
Webpack serverless config
This file contains 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 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