1 year ago
#386585
Udders
Vuex shared across packages in a monorepo
I am working in a monorepo that has a structure a little like,
- packages
- web_app
- mobile_app
- white_labelled_product
- shared_resources
I am wanting to integrate a vuex store into theses packages, now some of the store will be unique to the package, but alot of the vuex store will be used across all my packages so I was hoping I could create a new package and load in vuex modules where I need them,
- packages
- web_app
- mobile_app
- white_labelled_product
- shared_resources
- vuex
- dist
- index.js
- src
- modules
- users
- state.js
- actions.js
- mutations.js
- getters.js
- index.js
- types.js
In the above above example I have users modules and in the index.js
file I would have something like,
import actions from './actions'
import mutations from './mutations'
import getters from './getters'
import state from './state'
export default {
actions,
mutations,
getters,
state
}
Then to use it in another package I would need to do,
import users from '@mypackages/vuex/src/modules/users/'
Is there a way I can use the dist folder in my vuex package so I can just do,
import users from '@mypackages/vuex'
do I have to import it and then export it in the index.js in /dist?
javascript
vue.js
vuex
lerna
0 Answers
Your Answer