Skip to content

Instantly share code, notes, and snippets.

@Jaikant
Last active January 9, 2018 08:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Jaikant/ffd1417c421faeee3c29a0634c45622e to your computer and use it in GitHub Desktop.
Save Jaikant/ffd1417c421faeee3c29a0634c45622e to your computer and use it in GitHub Desktop.
Minimum webpack.config.js from running sharp with nodejs
const webpack = require('webpack')
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',
module: {
loaders: [
{
test: /\.js$/,
loader: 'babel-loader',
exclude: /node_modules/,
}
],
},
output: {
filename: 'build.js',
},
externals: nodeModules,
}
Reference from: http://jlongster.com/Backend-Apps-with-Webpack--Part-I
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment