59naga / babel-plugin-add-module-exports

【v0.2 no longer maintained】 Fix babel/babel#2212 - Follow the babel@5 behavior for babel@6

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Can't import a module via another module that uses "* as sth".

ippei-tanaka opened this issue · comments

I have files like:

/scripts/person.js
/scripts/index.js
/scripts/runner.js

-- person.js

export const smile = () => {
    console.log(":)");
};

export const greet = () => {
    console.log("hello");
};

-- index.js

import * as person from './person';
export default person;

-- runner.js

import person1 from './';
var person2 = require('./');
import * as person3 from './person';

console.log("person1:", person1);
console.log("person2:", person2);
console.log("person3:", person3);

And, I ran runner.js from package.js:

babel-node ./scripts/runner.js

What I got was:

person1: undefined
person2: { smile: [Function: smile], greet: [Function: greet] }
person3: { smile: [Function: smile], greet: [Function: greet] }

this issue is fixed at 0.3.0-pre using addDefaultProperty

https://gist.github.com/59naga/2f205baa3ced672c1d9146deac297f4c#file-readme-md