I have a json config files that I want to not be bundled such that they are always loaded on app start. I can't seem to figure out how to properly do this.
Also in some cases the config file will contain a path to another file that has a require on it, not sure what webpack will do in that case.
var path = require('path');
var fs = require('fs');
var webpack = require('webpack');
var nodeModules = {};
fs.readdirSync('node_modules')
.filter(function(x) {
return ['.bin'].indexOf(x) === -1;
})
.forEach(function(mod) {
nodeModules[mod] = 'commonjs ' + mod;
});
nodeModules["config.json"] = "config";
module.exports = {
entry: './app.js',
target: 'node',
node: {
__dirname: false,
__filename: false
},
output: {
path: __dirname,
filename: 'backend.js'
},
externals: [ nodeModules]
};