using vue cli or webpack to build individual vue components

时间:2019-03-19 14:40:04

标签: javascript vue.js webpack vue-cli vue-cli-3

Say I have the following components folder:

components/
  Component1.vue
  Component2.vue
  Component3.vue

Is there a way to build each of the individual components into this type of distribution:

dist/
  Component1/
    index.html
    script.js
    styles.css
  Component2/
    index.html
    script.js
    styles.css
  Component3/
    index.html
    script.js
    styles.css

Basically I need to build a components library. I'd like to use vue to build them, but the thing that's consuming components library needs html file, css file and js file for each component instead of a vue SFC.

Using vue-cli-service build i know I'm able to pass in a different entry instead of src/App.vue, but the distro doesn't seem to work when I run it on a simple server. Are there any gotchas with changing the entry point and corresponding build configurations? Also, if there any solid references for how to tackle this problem I'm trying to solve, would be greatly appreciated.

0 个答案:

没有答案