项目原始demo,不改动
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
This repo is archived. You can view files and clone it, but cannot push or open issues/pull-requests.

ExternalsPlugin.js 529 B

4 years ago
123456789101112131415161718192021
  1. /*
  2. MIT License http://www.opensource.org/licenses/mit-license.php
  3. Author Tobias Koppers @sokra
  4. */
  5. "use strict";
  6. const ExternalModuleFactoryPlugin = require("./ExternalModuleFactoryPlugin");
  7. class ExternalsPlugin {
  8. constructor(type, externals) {
  9. this.type = type;
  10. this.externals = externals;
  11. }
  12. apply(compiler) {
  13. compiler.plugin("compile", (params) => {
  14. params.normalModuleFactory.apply(new ExternalModuleFactoryPlugin(this.type, this.externals));
  15. });
  16. }
  17. }
  18. module.exports = ExternalsPlugin;