davestewart / vuex-pathify

Vue / Vuex plugin providing a unified path syntax to Vuex stores
https://davestewart.github.io/vuex-pathify
MIT License
1.37k stars 57 forks source link

Custom pathify options need to export `*` ? #63

Open stevage opened 5 years ago

stevage commented 5 years ago

The documentation advises setting up a config module like this:

import pathify from 'vuex-pathify'
export default pathify

// options
pathify.options.mapping = 'simple'
pathify.options.deep = false

However, you can't use such a module as a drop-in for vuex-pathify because it doesn't contain the full range of exports, such as make. So I think after export default pathify this line needs to be added:

export * from 'vuex-pathify';

Or I just didn't understand :)

davestewart commented 5 years ago

Hmm. Not sure I understand!?

In the rest of your code, you'll just import and use pathify from its node_modules location, e.g:

import { get, sync } from 'vuex-pathify'
...

Perhaps it's this that is confusing you?

The initial config file is just to apply settings to this global object.

stevage commented 5 years ago

Yeah, I think that's the bit that wasn't clear from the doc:

In your store's index file make sure to import the local config file rather than the package:

I guess I read that as "In your store's index file (and other places), make sure to..."

This sentence could be clearer:

Then finish setting up your project as you would otherwise.

Maybe:

Elsewhere in your project, use the normal import { get, sync } from 'vuex-pathify' format. You only need to use your configured version in the index.

davestewart commented 5 years ago

I'm updating the docs for the recent release, so I'll look to add this / something like it.