Skip to content

Instantly share code, notes, and snippets.

@jadbox
Created April 1, 2016 18:55
Show Gist options
  • Save jadbox/e1d6f409bac4162151f9a12090fdaa44 to your computer and use it in GitHub Desktop.
Save jadbox/e1d6f409bac4162151f9a12090fdaa44 to your computer and use it in GitHub Desktop.
var webpack = require('webpack');
var path = require('path');
var fs = require('fs');
var nodeModules = { classnames: 'commonjs classnames', react: 'commonjs react' };
fs.readdirSync('node_modules')
.filter(function(x) {
return ['.bin'].indexOf(x) === -1;
})
.forEach(function(mod) {
nodeModules[mod] = 'commonjs ' + mod;
});
module.exports = {
context: __dirname,
entry: {
"server-entry": path.join(__dirname, "index.js")
},
target: 'node',
resolveLoader: {
modulesDirectories: [
path.join(__dirname, "node_modules")
]
},
module: {
loaders: [{
test: /\.js$/,
include: [
path.resolve(__dirname, "controllers")
],
exclude: /(node_modules|test|views)/,
loader: 'babel',
query: {
cacheDirectory: '/tmp',
presets: ['es2015'],
plugins: [
"transform-function-bind"
]
}
}]
},
output: {
filename: "[name].gen.js",
libraryTarget: "commonjs",
library: "",
path: path.resolve(__dirname)
},
plugins: [
],
externals: nodeModules,
devtool: 'eval',
debug: true
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment