NodeTargetPlugin.js 508 B

12345678910111213141516171819
  1. /*
  2. MIT License http://www.opensource.org/licenses/mit-license.php
  3. Author Tobias Koppers @sokra
  4. */
  5. "use strict";
  6. const ExternalsPlugin = require("../ExternalsPlugin");
  7. const builtins =
  8. // eslint-disable-next-line node/no-unsupported-features/node-builtins,node/no-deprecated-api
  9. require("module").builtinModules || Object.keys(process.binding("natives"));
  10. class NodeTargetPlugin {
  11. apply(compiler) {
  12. new ExternalsPlugin("commonjs", builtins).apply(compiler);
  13. }
  14. }
  15. module.exports = NodeTargetPlugin;