How can I create two separate bundles with vue-cli 3?

Assuming you need completely separate builds, with some shared scripts guided by your entries, you can add separate build commands.

In your package.json “scripts” section:

"scripts": {
    "build:admin": "vue-cli-service build --dest dist/admin src/admin/index.js,
    "build:public": "vue-cli-service build --dest dist/public src/public/index.js

For admin builds, you may run:

npm run build:admin

and for public builds:

npm run build:public

For more information, view the build target docs.

Leave a Comment