6

I'm building new project using Typescript, Vue, webpack and lerna to manage related packages. Structure of my project is:

/packages
    /lib-vue-components
    /lib-ts-components
   /app

lib-vue-components are meant to be reusable components which i would use in any other Vue component within my app: i.e

import {MyComponent} from "lib-vue-components"

@Component({components: MyComponent})
class AppComponent extends Vue {
        ....
        })

I thinkng about 2 approaches:

  1. Do not build lib-vue-components as separate build, just use sources directly and build everything togehter with App project. This is the simplest way but do not allow to public lib-vue-componenets to npm.

2) Build lib-vue-components separetly and then use it in App projec as external libt. This is the way which looks the best for me but i not sure how to build pure vue+typescript components lib, cause webpack always addes a lot of code to output bundle(i.e it adds Vue itself).

Do you have any recepies/ideas what approach would be the best in this scenario?

abradas
  • 91
  • 4
  • What approach did you end up using? – Jeremy Walters Feb 07 '19 at 13:41
  • Right now i't using first approach. – abradas Feb 08 '19 at 14:05
  • To do the second option you would probably need to break your lib components into a totally separate new project and create npm packages from that. Unless you reuse your components in several other projects I don't see any advantage to this approach. – LPains Feb 18 '19 at 02:50

0 Answers0