warnAboutDeprecatedCJSRequire.js 902 B

1234567891011121314151617181920212223242526272829303132333435
  1. 'use strict';
  2. var printWarning = function() {};
  3. if (process.env.NODE_ENV !== 'production') {
  4. printWarning = function(format, subs) {
  5. var index = 0;
  6. var message =
  7. 'Warning: ' +
  8. (subs.length > 0
  9. ? format.replace(/%s/g, function() {
  10. return subs[index++];
  11. })
  12. : format);
  13. if (typeof console !== 'undefined') {
  14. console.error(message);
  15. }
  16. try {
  17. // --- Welcome to debugging history ---
  18. // This error was thrown as a convenience so that you can use the
  19. // stack trace to find the callsite that triggered this warning.
  20. throw new Error(message);
  21. } catch (e) {}
  22. };
  23. }
  24. module.exports = function(member) {
  25. printWarning(
  26. 'Please use `require("history").%s` instead of `require("history/%s")`. ' +
  27. 'Support for the latter will be removed in the next major release.',
  28. [member, member]
  29. );
  30. };