I am writing a demo using store.js.
Briefly, there are two files index.html
and base.js
and the folder node_mudules
.
I install the store.js by:
npm i store
In the index.html, it is referenced in the header:
<script src="node_modules/jquery/dist/jquery.js"></script>
<script src="js/base.js"></script>
<script src="node_modules/store/store.js"></script>
But when I tried to use it in the base.js like:
store.set('user', { name:'Marcus' })
This error:
Uncaught ReferenceError: store is not defined
I am sure the path is correct, because it is referenced by the same way as jquery, and the jquery works well.
I also download the whole repo and copy the store.legacy.min.js
to my project, referenced in the header:
<script src="node_modules/jquery/dist/jquery.js"></script>
<script src="js/base.js"></script>
<script src="./store.legacy.min.js"></script>
The same error:
Uncaught ReferenceError: store is not defined
What is wrong? Any help gratefully received...
use this:
<script src="node_modules/store/store.js"></script>
<script src="node_modules/jquery/dist/jquery.js"></script>
<script src="js/base.js"></script>