Skip to content

Instantly share code, notes, and snippets.

@AJ-7885
Last active August 10, 2018 13:12
Show Gist options
  • Save AJ-7885/c8145996402855e604223a8723d62e9d to your computer and use it in GitHub Desktop.
Save AJ-7885/c8145996402855e604223a8723d62e9d to your computer and use it in GitHub Desktop.
webpack.config.js
const path = require('path');
const fs = require('fs');
const nodeModules = {};
fs.readdirSync('node_modules')
.filter((x) => {
return ['.bin'].indexOf(x) === -1;
})
.forEach((mod) => {
nodeModules[mod] = 'commonjs ' + mod;
});
module.exports = {
entry: './src/server.js',
target: 'node',
devtool: 'source-map',
output: {
path: path.resolve(__dirname, 'build'),
filename: 'server.js'
},
externals: nodeModules,
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment