Created
February 20, 2019 14:30
-
-
Save pfrozi/ca26068b0e88cf5ed21ba2443a488a28 to your computer and use it in GitHub Desktop.
Webapack config for node
This file contains hidden or 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
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