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

后端 未结 4 917
星月不相逢
星月不相逢 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:41

    Building on the other answers here, I've found it's possible to specify the build output directory in vue.config.js rather than having to do that in the command line. So then combining that with the use of the VUE_CLI_SERVICE_CONFIG_PATH environment variable makes things a lot simpler - no need for it to copy/delete config files each time you build.

    You do have to specify the full paths to the Vue config files though. This works even on Windows, but only from a Linux-type terminal (e.g. I tested it from Git Bash installed by Git for Windows and it worked fine, but doesn't work from the normal Windows Command Prompt, as I couldn't find any way of setting the environment variable in the npm script which worked when run from there)

    https://gist.github.com/EdwardMillen/0c417747cd8ce64b8ba550bdfa582cf5

提交回复
热议问题