url.js 921 B

1234567891011121314151617181920212223
  1. /*
  2. MIT License http://www.opensource.org/licenses/mit-license.php
  3. Author Tobias Koppers @sokra
  4. */
  5. var loaderUtils = require("loader-utils"),
  6. path = require("path");
  7. module.exports = function() {};
  8. module.exports.pitch = function(remainingRequest) {
  9. this.cacheable && this.cacheable();
  10. return [
  11. "// style-loader: Adds some reference to a css file to the DOM by adding a <link> tag",
  12. "var update = require(" + JSON.stringify("!" + path.join(__dirname, "addStyleUrl.js")) + ")(",
  13. "\trequire(" + loaderUtils.stringifyRequest(this, "!!" + remainingRequest) + ")",
  14. ");",
  15. "// Hot Module Replacement",
  16. "if(module.hot) {",
  17. "\tmodule.hot.accept(" + loaderUtils.stringifyRequest(this, "!!" + remainingRequest) + ", function() {",
  18. "\t\tupdate(require(" + loaderUtils.stringifyRequest(this, "!!" + remainingRequest) + "));",
  19. "\t});",
  20. "\tmodule.hot.dispose(function() { update(); });",
  21. "}"
  22. ].join("\n");
  23. };