Projekt

Obecné

Profil

Stáhnout (1.47 KB) Statistiky
| Větev: | Revize:
1
if (__DEV__) {
2
  if (typeof window !== "undefined") {
3
    const global = window;
4
    const key = "__react_router_build__";
5
    const buildNames = { cjs: "CommonJS", esm: "ES modules", umd: "UMD" };
6

    
7
    if (global[key] && global[key] !== process.env.BUILD_FORMAT) {
8
      const initialBuildName = buildNames[global[key]];
9
      const secondaryBuildName = buildNames[process.env.BUILD_FORMAT];
10

    
11
      // TODO: Add link to article that explains in detail how to avoid
12
      // loading 2 different builds.
13
      throw new Error(
14
        `You are loading the ${secondaryBuildName} build of React Router ` +
15
          `on a page that is already running the ${initialBuildName} ` +
16
          `build, so things won't work right.`
17
      );
18
    }
19

    
20
    global[key] = process.env.BUILD_FORMAT;
21
  }
22
}
23

    
24
export { default as MemoryRouter } from "./MemoryRouter";
25
export { default as Prompt } from "./Prompt";
26
export { default as Redirect } from "./Redirect";
27
export { default as Route } from "./Route";
28
export { default as Router } from "./Router";
29
export { default as StaticRouter } from "./StaticRouter";
30
export { default as Switch } from "./Switch";
31
export { default as generatePath } from "./generatePath";
32
export { default as matchPath } from "./matchPath";
33
export { default as withRouter } from "./withRouter";
34

    
35
import { useHistory, useLocation, useParams, useRouteMatch } from "./hooks.js";
36
export { useHistory, useLocation, useParams, useRouteMatch };
37

    
38
export { default as __RouterContext } from "./RouterContext";
(12-12/14)