Skip to content

Instantly share code, notes, and snippets.

@pfrozi
Created February 20, 2019 14:30
Show Gist options
  • Save pfrozi/ca26068b0e88cf5ed21ba2443a488a28 to your computer and use it in GitHub Desktop.
Save pfrozi/ca26068b0e88cf5ed21ba2443a488a28 to your computer and use it in GitHub Desktop.
Webapack config for node
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: './index.js',
target: 'node',
output: {
path: path.join(__dirname, 'build'),
filename: 'bundle.js'
},
externals: nodeModules
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment