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

localStorage is undefined && doesn't ignore node_modules #976

Closed
CodeDraken opened this issue Aug 23, 2017 · 3 comments

Comments

@CodeDraken
Copy link

commented Aug 23, 2017

localStorage.setItem('token', res.data.token)

This is giving me an error "'localStorage' is not defined. (no-undef)"

It's also checking files inside node_modules for some reason.

@dcousens

This comment has been minimized.

Copy link
Member

commented Aug 23, 2017

window.localStorage

@dcousens dcousens added the question label Aug 23, 2017

@bcomnes

This comment has been minimized.

Copy link
Member

commented Aug 23, 2017

Correct answer! Also https://npmjs.com/global if you want to get modular about it.

@dcousens dcousens closed this Aug 23, 2017

@LinusU

This comment has been minimized.

Copy link
Member

commented Aug 23, 2017

You could also add this comment to the top of the file, which would also work in web workers.

/* global localStorage */

see #619 for more details :)

@lock lock bot locked as resolved and limited conversation to collaborators May 10, 2018

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
4 participants
You can’t perform that action at this time.