Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update on babel 6 can cause 'require' to fail properly loading module #12

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

tcharlat
Copy link

@tcharlat tcharlat commented May 4, 2016

I tried to use the repo code to boiler plate a react-router + webpack lazyloading SPA.

I had the following browser console warning :

Warning: [react-router] Location "/about" did not match any routes

It is because since babel 6, the 'default' keyword is not compatible with 'require' as it was per babel 5

AboutRoute.js :

import About from '../components/About'

export default {
  path: 'about',
  component: About
}

RootRoute.js

  getChildRoutes(location, cb) {
    require.ensure([], (require) => {
-     cb(null, [ require('./AboutRoute')])
+     cb(null, [ require('./AboutRoute').default ])
    })
  },

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant