Closed curtisblackwell closed 8 years ago
I'm not sure what I was doing earlier, but I've got this working now.
Component.vue
(used as main
in package.json
<script>
import MyComponentA from './components/MyComponentA.vue';
import MyComponentB from './components/MyComponentB.vue';
import MyComponentC from './components/MyComponentC.vue';
import MyComponentD from './components/MyComponentD.vue';
export default {
MyComponentA,
MyComponentB,
MyComponentC,
MyComponentD,
};
</script>
If there's a better/recommended way to go about this, please share.
Your original approach should work the same regardless of whether you are using Browserify or Webpack.
I answered the very same question on Stack Overflow. If anyone wants to know the process/steps for very basic demo, check this link: https://stackoverflow.com/questions/47754244/create-component-to-be-used-via-npm/47757050#47757050
I've written a handful of components, and now I want to publish them to npm, so that I can use my components on separate, unrelated sites.
For simpler components, I know I can just add this to my
package.json
:…but some of my components are comprised of multiple components. I'm pretty sure I could use
Vue.extend()
on a "parent" component, but it seems like there would be a better way than that.I experimented with Browserify, too, and with that I achieved what I wanted by placing this in the file specified by
package.json
'smain
.Component's
main.js
Website's
main.js
Is there something similar (or better) that can be done with Vue's webpack-simple template?