Is there a way for Hot Reloading to occur on a local npm dependency of a local Vuetify application using yarn serve
(which is probably using webpack / vuetify-loader)?
BUSINESS CASE
We have some common Vuetify components that I'd like to expose with a "common-components" Vue Plugin and allow all of our Vuetify applications to pull those common components. I'm able to do so by packaging the plugin and creating the dependency and pushing to a private npm repo or a commit/push to a private git repo. The problem lies with the development cycle and development experience.
A typical development change to the Plugin within the local development environment requires:
- (common-components)
yarn build
(to create the dist/common-components.umd.js) - (common-components) (deploy to a private npm rep or a commit/push to a git repo)
- (application A)
yarn upgrade common-components
to pull the latest - (application A)
yarn serve
There has to be a better development cycle than this, right? Or is my real problem that we need to decouple the plugin from our applications better?
THE SOLUTION I WAS HOPING FOR, BUT FAILED
yarn-link or npm-link
I was able to get this to work, but a NPM dependency still resolves to the folder's package.json which has a "main": "dist/common-components.umd.js"
. This requires me to do a yarn build
which removes the file and rebuilds it. When the file is removed, "application A" that is currently running with yarn serve
breaks and is unrecoverable. I must shut down the server and do a yarn serve
again.
I'm hoping there is a solution out there that tackles this scenario!