2
2
mirror of https://github.com/Llewellynvdm/nativefier.git synced 2024-11-10 15:21:03 +00:00
nativefier/webpack.config.js

33 lines
741 B
JavaScript
Raw Normal View History

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
},
externals: nodeModules,
module: {
loaders: [
2016-01-23 18:02:23 +00:00
{test: /\.js$/, exclude: /node_modules/, loader: 'babel-loader'}
]
}
2016-01-23 03:47:28 +00:00
};