Skip to content

Commit

Permalink
Used named imports for react-router in react-router-config
Browse files Browse the repository at this point in the history
I was recently doing some bundle size analysis using source-map-explorer
and noticed that we had a little bit of duplication of react-router
code. It seems as though our import of react-router-config was bringing
in modules from react-router/Foo, while our named imports from
react-router was bringing in modules from react-router/es/Foo.

As a workaround, I've set up a webpack alias to avoid the duplication,
but I think this should be solved in this package so that everyone can
benefit.

I believe this is similar to:

- remix-run#5589
  • Loading branch information
lencioni committed Aug 15, 2018
1 parent 562d3d7 commit cca4d8f
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 4 deletions.
3 changes: 1 addition & 2 deletions packages/react-router-config/modules/matchRoutes.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import matchPath from "react-router/matchPath";
import Router from "react-router/Router";
import { matchPath, Router } from "react-router";

// ensure we're using the exact code for default root match
const { computeMatch } = Router.prototype;
Expand Down
3 changes: 1 addition & 2 deletions packages/react-router-config/modules/renderRoutes.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import React from "react";
import Switch from "react-router/Switch";
import Route from "react-router/Route";
import { Switch, Route } from "react-router";

const renderRoutes = (routes, extraProps = {}, switchProps = {}) =>
routes ? (
Expand Down

0 comments on commit cca4d8f

Please sign in to comment.