vue import component: "Module is not installed"
I created a vue.js 2 project via vue-cli and created two simple components like this
<template>
<div class="jumbotron">
Dashboard
</div>
</template>
<script>
export default {
name: 'dashboard',
};
</script>
When importing the components like this (using webpack vue-loader) I get the warning that the Modules are not installed:
"Go To Declaration" also doesn't work.
帖子评论已关闭。
thx Elena, that was help.
But its default template of vuejs
I have the same problem after upgrade to 2017.2.2 when import "vue component". Before install that version, it works perfectly.
I uninstalled version 2017.2.2 this morning. And installed 2017.2.5, but get same problem.
By the way, I've already set the webpack config directory manual. But "Event Log" tells "Failed to load webpack.dev.conf.js"
It drives me crazy now. I don't know how to solve it.
Please make sure that `.vue` extension is added to import. If adding extension and invalidating caches doesn't help, please provide your idea.log and screenshot of Settings | Languages & Frameworks | JavaScript | Webpack page
I fixed it, like most of you I used vue-cli
the thing is that, webpack.dev.conf.js is only dev override, to get support for @, you need webpack BASE
there lies definition of @ alias
now, everything works as expected
This issue happens when using vue-cli 3.0, as the webpack config is hidden inside the service provided by Vue. Any ideas on how to solve this?
You can try specifying
node_modules/@vue/cli-service/webpack.config.js
as a config.Works for me:
Thanks Elena! Now is working as intended! It would be great if you guys could document this so other users know how to proceed. Have a nice day :)
thanks..
perfect. this was relevant for me as well with @vue/cli version 3.
The last solution solved it.
Found the webpack config path by pressing CMD+SHIFT+A and typing webpack and choosing the option from the preferences.
There I edited the path
Elena's solution does not work for me.
I've edited webpack.config.js location in Idea settings, but there is no alias specified in the webpack.config.js file. So how can Idea resolve aliases?
My webpack configuration:
Content of "webpack.config.js" file
I'm using cli-service version 3
Editor still does not recognize alias
>I've edited webpack.config.js location in Idea settings, but there is no alias specified in the webpack.config.js file. So how can Idea resolve aliases?
in the way similar to webpack - it loads the required modules/files dynamically using a node.js service and caches the resultant config as a .json that is then parsed to obtain aliases
Do you have your client-side node_modules located right in the project root, or in a subfolder?
Also, can you recreate the issue and provide your idea.log (https://intellij-support.jetbrains.com/hc/en-us/articles/207241085-Locating-IDE-log-files)?
> Do you have your client-side node_modules located right in the project root, or in a subfolder?
I've node_modules is located in the root directory of Vue.js project. But the problem may be that the Vue.js project is not in the root of Intellij IDEA project.
I've done some experiments:
The cause is probably same as https://intellij-support.jetbrains.com/hc/en-us/community/posts/360000578284--alias-in-vue-cli-3-projects
>But the problem may be that the Vue.js project is not in the root of Intellij IDEA project
That's the issue - https://youtrack.jetbrains.com/issue/WEB-32564. IDEA uses project root dir as cwd when resolving aliases, so src folder is resolved relative to the project root, not to your Vue.js app folder.
So your issue is indeed the same as https://intellij-support.jetbrains.com/hc/en-us/community/posts/360000578284--alias-in-vue-cli-3-projects
Closing the thread for further comments; if you can't find the anser in this thread, please feel free to start a new thread/create a support ticket