问题
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:
Copy everything from index to user/login, only change the configuration.
Make /user/login two folder structure to /user one folder structure, also does not work.
I tested, as long as I offer a value for the
entry
underpage
, 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