Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Get list of excluded module in webpak config
module.exports = function(){
var fs = require("fs");
var nodeExternal = {};
var pkg = JSON.parse(fs.readFileSync('package.json', { encoding: 'utf-8' }));
Object.keys(pkg.dependencies).forEach(function (name) {
nodeExternal[name] = "require('" + name + "')";
});
Object.keys(pkg.devDependencies).filter(function (v) { return !v.match(/@types/); }).forEach(function (name) {
nodeExternal[name] = "require('" + name + "')";
});
console.log('externals', nodeExternal);
return nodeExternal;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.