Importing/exporting the Express router using ES6 import + export keywords and Babel Importing/exporting the Express router using ES6 import + export keywords and Babel express express

Importing/exporting the Express router using ES6 import + export keywords and Babel


The problem is that you are exporting router as named export router, but trying to import it as indexRoute.

You should either rename your export:

export { router as indexRoute }

or change your import:

import { router as indexRoute } from './routes/index_route';


Try this:

export default router;