tazsingh / pegasus-loader

File-System based Route declarations for React Router

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Broken in babel 6

joshacheson opened this issue · comments

pegasus-loader doesn't work in projects that compile with babel 6. This is because babel made necessary fixes to import/export syntax and as a result no longer automatically selects the default export when importing an esModule. Instead, when using require syntax (as opposed to import) you have to manually do something like require(myModule).default.

In pegasus-loader the entire module (which is really a wrapper object/esModule) gets passed along getComponents, causing an error downstream. We should probably either:

A) Publish a new version which accommodates babel 6 exclusively because it's 2016!
B) Do something like:

var module = require('./module');
cb(module.__esModule && module.default ? module.default : module);

C) ????