store
store copied to clipboard
How to import store.on?
First, thanks for this awesome lib..!
I'm using store2
on vue.js without problems, but now I want to import store.on
, how to do it?
import Storage from 'store2' // WORKS!
// Uncaught TypeError: Cannot read property '_' of undefined
import StoreOn from 'store2/src/store.on'
So, why not include extensions via "ES6 Destructuring and Module imports"? It could be nice do this:
import Storage, {StoreOn, StoreOverflow, StoreQuota} from 'store2'
Thanks
Sorry for the belated response, i've been on vacation. :) As for your suggestion, it sounds good, but i've barely dabbled in ES6 so far. I don't know what it would take to make this happen. Got a patch? Or an example?
Rollup can help on this.
Any update on this lib? The last commit is one year ago...
I still use store2 daily. Works fantastically still. :)
If i needed any changes, i'd be adding them. I don't need/use ES6 imports. I'm happy to take patches or maybe clearer explanations of what needs to be done. Heck, i'd even take money to do this. But i write enterprise open source, it's not an ego/hobby thing. So this issue will be resolved either when i need it for paid work or someone else contributes the changes.
You can solve this with webpack (or rollup):
Weback:
resolve: {
extensions: ['.js'],
alias: {
'store2/old': 'store2/src/store.old.js'
}
},
plugins: [
new webpack.ProvidePlugin({
'window.store': 'store2',
'store': 'store2'
})
]
In code:
import store from 'store2';
import 'store2/old';