2016-01-23 03:47:28 +00:00
|
|
|
var fs = require('fs');
|
|
|
|
|
2016-01-23 18:02:23 +00:00
|
|
|
// http://jlongster.com/Backend-Apps-with-Webpack--Part-I
|
2016-01-23 03:47:28 +00:00
|
|
|
// set all modules in node_modules as external
|
|
|
|
var nodeModules = {};
|
2016-01-23 18:02:23 +00:00
|
|
|
fs.readdirSync('./app/node_modules')
|
|
|
|
.filter(function(x) {
|
2016-01-23 03:47:28 +00:00
|
|
|
return ['.bin'].indexOf(x) === -1;
|
|
|
|
})
|
2016-01-23 18:02:23 +00:00
|
|
|
.forEach(function(mod) {
|
2016-01-23 03:47:28 +00:00
|
|
|
nodeModules[mod] = 'commonjs ' + mod;
|
|
|
|
});
|
|
|
|
|
|
|
|
// add electron to external module
|
2016-01-23 18:02:23 +00:00
|
|
|
nodeModules.electron = 'commonjs electron';
|
2016-01-23 03:47:28 +00:00
|
|
|
|
|
|
|
module.exports = {
|
|
|
|
target: 'node',
|
|
|
|
output: {
|
|
|
|
filename: 'main.js'
|
|
|
|
},
|
|
|
|
node: {
|
|
|
|
global: false,
|
|
|
|
__dirname: false
|
|
|
|
},
|
2016-01-23 04:42:09 +00:00
|
|
|
externals: nodeModules,
|
|
|
|
module: {
|
|
|
|
loaders: [
|
2016-01-23 18:02:23 +00:00
|
|
|
{test: /\.js$/, exclude: /node_modules/, loader: 'babel-loader'}
|
2016-01-23 04:42:09 +00:00
|
|
|
]
|
|
|
|
}
|
2016-01-23 03:47:28 +00:00
|
|
|
};
|