UNPKG

968 BJavaScriptView Raw
1/* eslint-disable prefer-arrow-callback, no-empty */
2var printWarning = function() {};
3
4if (process.env.NODE_ENV !== "production") {
5 printWarning = function(format, subs) {
6 var index = 0;
7 var message =
8 "Warning: " +
9 (subs.length > 0
10 ? format.replace(/%s/g, function() {
11 return subs[index++];
12 })
13 : format);
14
15 if (typeof console !== "undefined") {
16 console.error(message);
17 }
18
19 try {
20 // --- Welcome to debugging React Router ---
21 // This error was thrown as a convenience so that you can use the
22 // stack trace to find the callsite that triggered this warning.
23 throw new Error(message);
24 } catch (e) {}
25 };
26}
27
28export default function(member) {
29 printWarning(
30 'Please use `import { %s } from "react-router"` instead of `import %s from "react-router/es/%s"`. ' +
31 "Support for the latter will be removed in the next major release.",
32 [member, member]
33 );
34}