👋 Check out bobaekang/vue3-multiple-entry-points
repository for Vue 3 + Vite setup!
This repository is heavily inspired by this blog post on LogRocket, which introduces the multiple entry points solution for Create React App application. Please read the blog post for a detailed explanation for this setup as well as the original motivation.
Showcasing a simple multiple entry points setup for Vue 2 application. ✌️
This setup allows you to build multiple Vue 2 applications sharing components from a single repository. Switching build targets is controlled by the VUE_APP_BUILD_TARGET
environment variable. Check out /src/main.js
to see how this is done!
The key advantage of using multiple entry points is that this setup makes it trivial to share components between multiple Vue applications. No need for creating a separate component library package or setting up a sophisticated monorepo soultion.
One minor improvement over the original CRA solution is to simplify the logic for matching build target name with its path by replacing an array of objects to a single object; another minor improvement is to include a default build target (i.e. /src/App.vue
), so that the build process can succeed without explicitly specifying the target in .env
.
npm install
npm run serve
npm run build
npm run lint