Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot import CreateSagaMiddleware #1967

Closed
fibonacid opened this issue Nov 1, 2019 · 2 comments
Closed

Cannot import CreateSagaMiddleware #1967

fibonacid opened this issue Nov 1, 2019 · 2 comments

Comments

@fibonacid
Copy link

fibonacid commented Nov 1, 2019

Steps to reproduce

  1. create-react-app myapp
  2. Add "resolutions": { "**/**/fsevents": "1.2.9" } to package.json to solve this issue.
  3. yarn add redux-saga

Here is my repository

Description of the bug/issue

Cannot create middleware because function createSagaMiddleware cannot be imported.

Steps to reproduce the bug/issue

import { applyMiddleware, createStore } from 'redux'
import { composeWithDevTools } from 'redux-devtools-extension'
import { rootReducer } from './reducers/rootReducer'
import rootSaga from './sagas/rootSaga';
import createSagaMiddleware from 'redux-saga'

export default function configureStore(preloadedState) {

    const sagaMiddleware = createSagaMiddleware();
    const middlewareEnhancer = applyMiddleware(sagaMiddleware);

    const enhancers = [middlewareEnhancer];
    const composedEnhancers = composeWithDevTools(...enhancers);

    const store = createStore(rootReducer, preloadedState, composedEnhancers);

    store.sagaTask = sagaMiddleware.run(rootSaga);

    return store
}

Actual results

SagaMiddleware is null because function createSagaMiddleware doesn't exist;
My IDE alerts me that imported module doesn't have a default export declared.

Environment information

macOS 10.15.1
node v12.8.0
yarn 1.17.3
create-react-app 3.1.1
redux-saga 1.1.1

@Andarist
Copy link
Member

Andarist commented Nov 1, 2019

After installing your repository and adding:

import createSagaMiddleware from 'redux-saga'
console.log({ createSagaMiddleware })

I can see:
Screenshot 2019-11-01 at 23 18 02

@fibonacid
Copy link
Author

UPDATE
I've managed to make the program work on my machine with the following configuration.

nvm 0.35.0
node v12.13.0
yarn 1.19.1

Closing the issue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants