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

后端 未结 4 905
星月不相逢
星月不相逢 2021-01-30 21:15

I want to build two separate vue apps that will be served on two different routes in an express application: a ‘public’ vue app and an ‘admin’ vue app. These two apps have their

4条回答
  •  夕颜
    夕颜 (楼主)
    2021-01-30 21:46

    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.

提交回复
热议问题