Skip to content

Trouble with multiples exports #86

@christophedebatz

Description

@christophedebatz

Hi,

I'm facing an issue with this plugin.

So in file a.js i've this code:

export default class Foo { };
export const bar = { buzz: 3 };

When I look at babel's plugin output, it is:

exports.default = Foo;
module.exports = exports.default;

So, in another file, I can easily call my class Foo by an import foo from './a'
But, I cannot call my second export bar, so when I type import { bar } from './a' and then console.log(bar.buzz) it throw an error Cannot read property 'buzz' of undefined.

The only "solution" I have is to add manually this:

module.exports.bar = exports.bar;

Obvioulsy, it's not a solution for me :-)

Any idea about this problem concerning the other export than the default one? Thanks,

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions