Today, in the initialization project, a strange situation occurred: the path is obviously correct, but when compiling, the error "This dependency was not found" was always reported.
The code is as follows:
import Vue from 'vue' import App from './App' import router from './router' import 'common/stylus/' /* eslint-disable no-new */ new Vue({ el: '#app', render: h => h(App) })
The console keeps reporting an error, indicating that it cannot be foundcommon/stylus/
, however, the path is filled in through the ide completion, and there is no error, so why?
After searching online, I found that when introducing files in Vue, I need to notify the compiler that it is in the current path through ./. Otherwise, the first folder name will be considered as alias (alias) configured by webpack.
So, the correct way to introduce it is:
import Vue from 'vue' import App from './App' import router from './router' import './common/stylus/' // Add ./ Avoid the compiler considering it an alias/* eslint-disable no-new */ new Vue({ el: '#app', render: h => h(App) })
Summarize
The above is the solution to the problem of "This dependency was not found" in Vue introduced to you by the editor. I hope it will be helpful to everyone. If you have any questions, please leave me a message and the editor will reply to everyone in time. Thank you very much for your support for my website!