Importing constants not working #51

Closed
opened 2015-11-26 10:55:03 +00:00 by victornguyen · 2 comments
victornguyen commented 2015-11-26 10:55:03 +00:00 (Migrated from github.com)

In the README's "Actions" example:

import { LOAD, SAVE } from 'redux-storage';

Importing the constants in this way doesn't work as they are exposed as properties of the default export object, rather than as named exports.

I've gotten around this with something like:

import storage from 'redux-storage';
const { LOAD, SAVE } = storage;

We could either:

  1. Update the README example, or
  2. Change the way the constants are exported

What do you think?

In the README's "Actions" example: ``` js import { LOAD, SAVE } from 'redux-storage'; ``` Importing the constants in this way doesn't work as they are exposed as properties of the default export object, rather than as named exports. I've gotten around this with something like: ``` js import storage from 'redux-storage'; const { LOAD, SAVE } = storage; ``` We could either: 1. Update the README example, or 2. Change the way the constants are exported What do you think?
michaelcontento commented 2015-11-29 21:20:12 +00:00 (Migrated from github.com)

Thank you for reporting this!

It broke with switching from babel@5 to babel@6 (more details) 😢

But I've been able to:

  • fix this bug
  • updated the README to encourage import * as storage from 'redux-storage' for full imports
  • but also keep the old behaviour import storage from 'redux-storage'

A new version (v1.3.4) is already published to npm 🚀

Thank you for reporting this! It broke with switching from babel@5 to babel@6 ([more details](https://stackoverflow.com/questions/33505992/babel-6-changes-how-it-exports-default/33506169#33506169)) :cry: But I've been able to: - fix this bug - updated the README to encourage `import * as storage from 'redux-storage'` for full imports - but also keep the old behaviour `import storage from 'redux-storage'` A new version (`v1.3.4`) is already published to npm :rocket:
victornguyen commented 2015-12-01 12:09:09 +00:00 (Migrated from github.com)

Awesome 🎉

Thanks for providing such a comprehensive solution!

Awesome :tada: Thanks for providing such a comprehensive solution!
This discussion has been locked. Commenting is limited to contributors.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
MichaelContento/redux-storage#51
No description provided.