Create your own personal repository within your package.json
Your Library repository featuring .vue
components
package.json
{
"name": "my-personal-package-with-components",
"version": "1.0.0",
"files": [
"lib/js/components/**.vue"
]
}
Integrating the components into your project
package.json
{
"devDependencies": {
"my-personal-package-with-components": "git+ssh://git@my/repo.git#master",
}
}
To use the .vue files in your application, import them as follows:
import SpecialComponent1 from 'my-personal-package-with-components/lib/js/components/SpecialComponent1.vue';
import SpecialComponent2 from 'my-personal-package-with-components/lib/js/components/SpecialComponent2.vue';
Vue.component('special-component-1', SpecialComponent1);
Vue.component('special-component-2', SpecialComponent2);
For easier development, utilize npm link
:
https://docs.npmjs.com/cli/v8/commands/npm-link
cd mylib/ && npm link
cd ../myapp && npm link mylib