How to deal with this error when creating multi-page application with Vue CLI3.0?

偶尔善良 提交于 2020-06-27 06:13:41

问题


I am a beginner of Vue.js, when I am creating a multi-page project, I am having some wired problems and I really cannot solve them. The error message is:

 ERROR  Failed to compile with 1 errors                                                                                                                                                                                 1:46:11 PM

This dependency was not found:

* /home/Username/Web/wk_front_end/src/user/login/login.js in multi ./src/user/login/login.js

To install it, you can run: npm install --save /home/Username/Web/wk_front_end/src/user/login/login.js

 ERROR  Build failed with errors.

And I am splitting the different pages with vue.config.js:

module.exports = {
  pages: {
    index: {
      entry: "src/index/main.js",
      template: "src/index/index.html",
      filename: "index.html",
      title: "Index Page"
    },
    user_login: {
      entry: "src/user/login/login.js",
      template: "src/user/login/login.html",
      filename: "login.html",
      title: "Login Page"
    }
  }
}

And the file tree under src folder is is:

As you can see, there are two pages: the index page and the user login page, all signed up in vue.config.js, but I am having the trouble with the dependency not found. Wired thing is, the dependency vue is describing is one of my entry javascript file. Does anyone know how this problem can be solved?

I am following the instruction from: Instruction: Configuration Reference #Global CLI Config

And here's another method I tried: Configure VueJS pages (multiple pages in vue.config.js) MPA

Here is another Vue CLI3.0 multi-page project article(it is in Chinese) https://zhuanlan.zhihu.com/p/54565975

Really appreciate the help.

What I have tried:

  1. Copy everything from index to user/login, only change the configuration.

  2. Make /user/login two folder structure to /user one folder structure, also does not work.

  3. I tested, as long as I offer a value for the entry under page, there will be such error.

来源:https://stackoverflow.com/questions/62476995/how-to-deal-with-this-error-when-creating-multi-page-application-with-vue-cli3-0

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!