Skip to content

Instantly share code, notes, and snippets.

@emcniece
Created July 15, 2016 01:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save emcniece/16bb37d0f39989102937ecabffb713fc to your computer and use it in GitHub Desktop.
Save emcniece/16bb37d0f39989102937ecabffb713fc to your computer and use it in GitHub Desktop.
var webpack = require('webpack');
var path = require('path');
var fs = require('fs');
var nodeModules = fs.readdirSync('node_modules')
.filter(function(x) {
return ['.bin'].indexOf(x) === -1;
});
module.exports = {
entry: [
'babel-polyfill',
'./server/app.js'
],
debug: true,
target: 'node',
output: {
filename: 'backend.js',
path: path.resolve(__dirname, 'server')
},
node: {
__dirname: true,
__filename: true
},
externals: [
function(context, request, callback) {
var pathStart = request.split('/')[0];
if (nodeModules.indexOf(pathStart) >= 0 && request != 'webpack/hot/signal.js') {
return callback(null, "commonjs " + request);
};
callback();
}
],
plugins: [
new webpack.IgnorePlugin(/\.(css|less)$/),
new webpack.BannerPlugin('require("source-map-support").install();',
{ raw: true, entryOnly: false }),
new webpack.HotModuleReplacementPlugin({ quiet: true })
]
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment