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

How to import store.on? #31

Open
frangeris opened this issue Aug 1, 2016 · 5 comments
Open

How to import store.on? #31

frangeris opened this issue Aug 1, 2016 · 5 comments

Comments

@frangeris
Copy link

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

@nbubna
Copy link
Owner

nbubna commented Aug 8, 2016

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?

@aMarCruz
Copy link

Rollup can help on this.

@hustcer
Copy link

hustcer commented Oct 10, 2016

Any update on this lib? The last commit is one year ago...

@nbubna
Copy link
Owner

nbubna commented Oct 10, 2016

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.

@gregorskii
Copy link

gregorskii commented Nov 9, 2017

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';

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants