Open yongjun21 opened 6 years ago
vue-cli-service serve
is expected to serve apps only.
In the docs, it's specified that we can supply an entry file. It seems weird that this is allowed if the purpose of vue-cli-service serve
is only to serve app.
Is there any plan to match the behavior for cli-service-global some time in future?
entry
means app entry.
Ummm... I'm not sure. But you can have a try and open a PR on it. It is also doable by introducing a plugin.
The core logic of instant prototyping is here: https://github.com/vuejs/vue-cli/blob/dev/packages/%40vue/cli-service-global/lib/globalConfigPlugin.js
The reason I was asking this in the first place is because I am creating a UI library for my team and wants my developers and designers to be able to individually serve the Vue component they are working on. But turns out vue serve
is not the best option also as often the UI components do not exist in isolation and requires some props to be passed in. So I ended up using Storybook.
But anyway thanks for clarifying. Will be helpful if this is mentioned in the doc: that vue serve
is more for prototyping self contained components and tools like Storybook will have been more suited for prototyping components that requires context.
Version
3.0.1
Reproduction link
https://bitbucket.org/yongjun21/example/src/master/
Node and OS info
Node 8.11.3
Steps to reproduce
Run
npx vue-cli-service serve src/components/Test.vue
What is expected?
Component mounted when index.html opened
What is actually happening?
Component not mounted. Though can be located in app.js
If I use cli-service-global (i.e.
vue serve src/components/Test.vue
), component gets mounted.