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

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

    I am also very interested by this matter.

    Maybe we can solve this issue with subpages :

    https://cli.vuejs.org/config/#pages : "Build the app in multi-page mode. Each "page" should have a corresponding JavaScript entry file. The value should be an object where the key is the name of the entry, and the value is either:"

    module.exports = {
      pages: {
        index: {
          // entry for the *public* page
          entry: 'src/index/main.js',
          // the source template
          template: 'public/index.html',
          // output as dist/index.html
          filename: 'index.html'
        },
        // an admin subpage 
        // when using the entry-only string format,
        // template is inferred to be `public/subpage.html`
        // and falls back to `public/index.html` if not found.
        // Output filename is inferred to be `admin.html`.
        admin: 'src/admin/main.js'
      }
    }
    

提交回复
热议问题