A
A
Alexander Savenko2018-03-23 19:44:46
Vue.js
Alexander Savenko, 2018-03-23 19:44:46

How to build 2 different bundles on Vue-cli 3?

There is a task to run the application in parts on Vue. First admin , then public. Many components are used from each other. According to the structure, it would be logical to create it like this:

my-app/
+- ...
+- dist/
|  +- admin/        Админка
|  +- public/        Для пользователей
+- src/
|  +- components/    Общие компоненты
|  +- admin/         Entry point, router, store... для админки
|  +- public/        Entry point, router, store... для пользователей
+- ...

In the root of the site I created a file vue.config.js Inserted
into it
module.exports = {
  // tweak internal webpack configuration.
  // see https://github.com/vuejs/vue-cli/blob/dev/docs/webpack.md
  chainWebpack: config => {
    // If you wish to remove the standard entry point
    config.entryPoints.delete('app')

    // then add your own
    config.entry('admin')
      .add('./src/admin/index.js')
      .end()
    .entry('public')
      .add('./src/public/index.js')
      .end()
  }
}

Now the project understands that there are 2 entry points
But I can’t set up the launch of the dev server for such localhost:8080/admin and localhost:8080/public and build the project (((

Answer the question

In order to leave comments, you need to log in

1 answer(s)
F
FeelGood, 2019-12-19
@FeelGood

Try using https://cli.vuejs.org/ru/config/#pages instead of specifying different entries

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question