vuex-pathify icon indicating copy to clipboard operation
vuex-pathify copied to clipboard

Custom pathify options need to export `*` ?

Open stevage opened this issue 6 years ago • 3 comments

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 :)

stevage avatar Jun 17 '19 05:06 stevage

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.

davestewart avatar Jun 17 '19 07:06 davestewart

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.

stevage avatar Jul 26 '19 03:07 stevage

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

davestewart avatar Sep 11 '19 22:09 davestewart