warnAboutDeprecatedESMImport.js 976 B

12345678910111213141516171819202122232425262728293031323334
  1. /* eslint-disable prefer-arrow-callback, no-empty */
  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 React Router ---
  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. export default function(member) {
  25. printWarning(
  26. 'Please use `import { %s } from "react-router-dom"` instead of `import %s from "react-router-dom/es/%s"`. ' +
  27. "Support for the latter will be removed in the next major release.",
  28. [member, member]
  29. );
  30. }