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

Uncaught ReferenceError: setImmediate is not defined ? #53

Closed
goodhyun opened this issue Jan 28, 2016 · 6 comments
Closed

Uncaught ReferenceError: setImmediate is not defined ? #53

goodhyun opened this issue Jan 28, 2016 · 6 comments

Comments

@goodhyun
Copy link
Contributor

I'm getting this error while building nw.js chromium app with this index.js

webpack:///./~/redux-persist/lib/persistStore.js?:49 Uncaught ReferenceError: setImmediate is not defined

I thought setImmediate was not supported natively in most of browsers.

import React from 'react';
import { render } from 'react-dom';
import { Provider } from 'react-redux';
import { Router } from 'react-router';
import routes from './routes';
import configureStore from './store/configureStore';
import './app.css';

import {persistStore, autoRehydrate} from 'redux-persist'


const store = configureStore();

persistStore(store);

render(
  <Provider store={store}>
    <Router>
      {routes}
    </Router>
  </Provider>,
  document.getElementById('root')
);

@goodhyun
Copy link
Contributor Author

Well, l didn't know that within a certain framework setImmediate is not automatically provided by global.setImmediate().
I sent a PR.

@rt2zz
Copy link
Owner

rt2zz commented Jan 28, 2016

accepted (with some modification) can you test on master to see if it is working as anticipated: npm install rt2zz/redux-persist

@noma4i
Copy link

noma4i commented Jan 30, 2016

Doesn't work. Solution was to
npm install setimmediate
and use
import setimmediate from 'setimmediate';

@goodhyun
Copy link
Contributor Author

Works like a charm.
Had to do npm run buildat the folder though.

@noma4i the setImmediate shim was only effective when you don't have global.setImmediate already. ?

@neurosnap
Copy link

On a fresh install I ran into this issue, it might be a good idea to mention this in the docs.

The fix:

npm install setimmediate
import 'setimmediate';
import { persistStore } from 'redux-persist';

@latchy
Copy link

latchy commented Oct 8, 2022

On a fresh install I ran into this issue, it might be a good idea to mention this in the docs.

The fix:

npm install setimmediate
import 'setimmediate';
import { persistStore } from 'redux-persist';

.. and 6 years later, this fixes my issue with nodemailer.
Though I didn't need to npm install it, I could just import it.
Thank you!

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

5 participants