marcuswestin / store.js

Cross-browser storage for all use cases, used across the web.
MIT License
14.01k stars 1.33k forks source link

TypeError: store.set is not a function #256

Open happyWilliam opened 6 years ago

happyWilliam commented 6 years ago

1.I use command: npm install store.js --dev-save 2.in my file, user codes below:

var store = require('store'); state.user = payload; store.set('user',payload);

and in browser console, it shows error: TypeError: store.set is not a function

wstam88 commented 6 years ago

I have the same issue...

wstam88 commented 6 years ago

Aah solved :) I got this error because of a webpack resolve alias which happened to share the same name store. Therefor importing or requiring store resolved to a folder and not the store.js package.