a zip code crypto-currency system good for red ONLY

RequireJsStuffPlugin.js 1.2KB

1234567891011121314151617181920212223242526272829303132
  1. /*
  2. MIT License http://www.opensource.org/licenses/mit-license.php
  3. Author Tobias Koppers @sokra
  4. */
  5. "use strict";
  6. const ParserHelpers = require("./ParserHelpers");
  7. const ConstDependency = require("./dependencies/ConstDependency");
  8. const NullFactory = require("./NullFactory");
  9. module.exports = class RequireJsStuffPlugin {
  10. apply(compiler) {
  11. compiler.plugin("compilation", function(compilation, params) {
  12. compilation.dependencyFactories.set(ConstDependency, new NullFactory());
  13. compilation.dependencyTemplates.set(ConstDependency, new ConstDependency.Template());
  14. params.normalModuleFactory.plugin("parser", function(parser, parserOptions) {
  15. if(typeof parserOptions.requireJs !== "undefined" && !parserOptions.requireJs)
  16. return;
  17. parser.plugin("call require.config", ParserHelpers.toConstantDependency("undefined"));
  18. parser.plugin("call requirejs.config", ParserHelpers.toConstantDependency("undefined"));
  19. parser.plugin("expression require.version", ParserHelpers.toConstantDependency(JSON.stringify("0.0.0")));
  20. parser.plugin("expression requirejs.onError", ParserHelpers.toConstantDependency("__webpack_require__.oe"));
  21. });
  22. });
  23. }
  24. };