marcuswestin / store.js

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

store.update doesn't create new object if its null #260

Open ThaneshR opened 6 years ago

ThaneshR commented 6 years ago

I created a index.html with the following code:

<html>
<head>
</head>
<body>
    <script type="text/javascript" src='./store.everything.min.js'></script>
    <script type="text/javascript">
        store.update('foo2', {}, function(foo2) {
            foo2.bar = 'cat';
        });
    </script>
</body>
</html>

I've included store.everything.min.js in the folder.

I ran this and got the following console error on Google Chrome (Version 62.0.3202.94 (Official Build) (64-bit)), Windows 10:

store.everything.min.js:2 Uncaught TypeError: t.charCodeAt is not a function
    at http://localhost/localstorage/store.everything.min.js:2:10614
    at Object._decompress (http://localhost/localstorage/store.everything.min.js:2:10713)
    at Object.decompress (http://localhost/localstorage/store.everything.min.js:2:10566)
    at Object.t (http://localhost/localstorage/store.everything.min.js:2:1415)
    at Object.(anonymous function) (http://localhost/localstorage/store.everything.min.js:2:14953)
    at e (http://localhost/localstorage/store.everything.min.js:2:14889)
    at Object.e (http://localhost/localstorage/store.everything.min.js:2:1700)
    at Object.(anonymous function) (http://localhost/localstorage/store.everything.min.js:2:14953)
    at e (http://localhost/localstorage/store.everything.min.js:2:14889)
    at Object.e (http://localhost/localstorage/store.everything.min.js:2:3181)
cemalgultekin commented 6 years ago

It's due to compress plugin being buggy. (didn't search through much though why it's buggy). Simply change e.exports = [t("./compression"), with e.exports = [ in store.everything.min.js and your code will work again. It's buggy in other browsers, too (eg. Firefox)

daweilv commented 6 years ago

same error @cemalgultekin it works! Thanks a lot