lelandrichardson / redux-pack

Sensible promise handling and middleware for redux
MIT License
1.33k stars 60 forks source link

module not found #4

Closed stunaz closed 7 years ago

stunaz commented 7 years ago

How to import the middleware via nom ? looks like there is an issue in your package.json file at


"main": "lib/index.js"
lelandrichardson commented 7 years ago

@stunaz can you show me the code you are trying to use to add the middleware?

I should put up an example in the readme for this... something like this should work:

import { createStore, applyMiddleware, compose } from 'redux';
import thunk from 'redux-thunk';
import pack from 'redux-pack';

const middlewares = [
  thunk,
  pack.middleware,
];

const store = createStore(reducer, applyMiddleware(...middlewares));
kyleshevlin commented 7 years ago

I am also getting an error that says: Module not found: Error: Cannot resolve module 'redux-pack' I've gotten this trying to use both:

import { handle } from 'redux-pack'

and:

import pack from 'redux-pack'

What else can I give you to help out?

kyleshevlin commented 7 years ago

Think I figured it out. Your package.json says lib, your directory is named src.

kyleshevlin commented 7 years ago

Damn, not reading closely enough, I see in your build step, you have the output directory of lib. Sorry for the many comments.

lelandrichardson commented 7 years ago

ohhh. are you pulling it locally? You would have to run npm run build in that case

kyleshevlin commented 7 years ago

I am not trying to run it locally. I used yarn to pull it into a project, attempted to import it into a few files to verify what @stunaz was seeing.

lelandrichardson commented 7 years ago

you're right. .gitignore accidentally was setup to not publish the lib directory. please upgrade to 0.1.1 and let me know if it's fixed! Thanks.

kyleshevlin commented 7 years ago

Solved it for me.

stunaz commented 7 years ago

solved too 👍 thanks