Skip to content

Instantly share code, notes, and snippets.

@abhirathore2006
Last active December 6, 2017 06:56
Show Gist options
  • Save abhirathore2006/8cf59c4c8b5900a4f6ad2c257ad024bf to your computer and use it in GitHub Desktop.
Save abhirathore2006/8cf59c4c8b5900a4f6ad2c257ad024bf 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;
})
.forEach(function(mod) {
nodeModules[mod] = 'commonjs ' + mod;
});
module.exports = {
entry: './server-build/server/server.js',
target: 'node',
output: {
path: path.join(__dirname, '/../build'),
filename: 'backend.js'
},
externals: nodeModules,
plugins: [
new webpack.DefinePlugin({
'process.env.NODE_ENV': JSON.stringify('production')
}),
new webpack.IgnorePlugin(/\.(css|less)$/),
new webpack.BannerPlugin({
banner: 'require("source-map-support").install();',
raw: true,
entryOnly: false
})
],
devtool: 'sourcemap'
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment