Skip to content
This repository was archived by the owner on Aug 4, 2021. It is now read-only.
This repository was archived by the owner on Aug 4, 2021. It is now read-only.

babel-converted module with default comes out wrong #29

@flying-sheep

Description

@flying-sheep

when trying to bundle redux, i get TypeError: _createStore.ActionTypes is undefined

the code in createStore.js is basically:

exports.__esModule = true
exports['default'] = createStore

var ActionTypes = { ... }
exports.ActionTypes = ActionTypes

function createStore(...) { ... }

which gets wrapped into createStore$1 followed by

var require$$3 = (createStore$1 && typeof createStore$1 === 'object' && 'default' in createStore$1 ? createStore$1['default'] : createStore$1);

var _createStore = require$$3;

and the failing code is var initialState = reducer(undefined, { type: _createStore.ActionTypes.INIT });

hmm, obviously _createStore gets assigned to the function createStore directly.

the failing line should convert to contain createStore$1.ActionTypes.INIT

isn’t there an effort to handle __esModule properly?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions