Last active
June 27, 2016 08:00
-
-
Save f0rr0/ed058713f644a92fff5c505e1191ab57 to your computer and use it in GitHub Desktop.
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 { resolve } = require('path'); | |
const { dependencies } = require('./package.json'); | |
const nodeModules = {}; | |
Object | |
.keys(dependencies) | |
.forEach((mod) => { | |
nodeModules[mod] = `commonjs ${mod}`; | |
}); | |
module.exports = (env) => ({ | |
context: resolve(__dirname, './src'), | |
entry: { | |
server: './index.js' | |
}, | |
target: 'node', | |
output: { | |
filename: '[name].js', | |
path: resolve(__dirname, './build'), | |
pathInfo: !env.prod | |
}, | |
devtool: env.prod ? 'source-map' : 'eval', | |
module: { | |
loaders: [ | |
{ | |
test: /\.js$/, | |
exclude: /node_modules/, | |
loaders: [ | |
'babel-loader' | |
] | |
} | |
] | |
}, | |
externals: nodeModules | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment