Unable to import parts of the Duck
kbrandwijk opened this issue · 3 comments
I wanted to use the syntax import { creators } from './MyDuck'
, but creators
turns up undefined
.
I can use import MyDuck from './MyDuck'
and use MyDuck.creators
, but it would be nice if I could only import the parts that I need (for example, only import types
in my sagas, only import creators
in my Containers, etc.
Hi @kbrandwijk
extensible-duck cannot control what is exported by your js file, nevertheless you can do the following:
const MyDuck = new Duck(...)
export default MyDuck
export const creators from MyDuck
@akelmanson Thank you. However, with export default MyDuck
, and creators
and types
being properties on the Duck, import { creators, types } from './MyDuck'
normally works. Is there anything special about the class that makes it return undefined?
@kbrandwijk Can you give me an example using a plain js object?