admin管理员组文章数量:1134578
This is starting to bug me and I'd either like it turned off or fixed. So Webstorm has a sweet feature in it's HTML parser that will attempt to resolve directories in strings that are supposed to reference a file in your project. For example:
Webstorm is correct. My front end code is all in /app
but my server serves up files in app on the root, so in the web context /app
is actually just /
. As a side, this behavior also impacts my angular templates:
and my angular-ui routes (I imagine it would do that for regular angular routes as well).
Is there a way that I can change webstorm to treat /app
as the root so this is a useful feature? If not, is there a way I can disable this? I tried going into the inspector, but couldn't find an option for it:
And no, it's not the XML one... I tried.
Help appreciated. Thanks...
This is starting to bug me and I'd either like it turned off or fixed. So Webstorm has a sweet feature in it's HTML parser that will attempt to resolve directories in strings that are supposed to reference a file in your project. For example:
Webstorm is correct. My front end code is all in /app
but my server serves up files in app on the root, so in the web context /app
is actually just /
. As a side, this behavior also impacts my angular templates:
and my angular-ui routes (I imagine it would do that for regular angular routes as well).
Is there a way that I can change webstorm to treat /app
as the root so this is a useful feature? If not, is there a way I can disable this? I tried going into the inspector, but couldn't find an option for it:
And no, it's not the XML one... I tried.
Help appreciated. Thanks...
Share Improve this question asked Feb 24, 2014 at 12:02 kentcdoddskentcdodds 29k33 gold badges111 silver badges192 bronze badges 07 Answers
Reset to default 215To make file references to a non-root folder in your project, you'll need to mark that directory as a Resource. To do this, go to Settings > Directories and select your asset root folder from the right-hand panel. Then mark it as Resource Root by clicking the button above the file browser.
From the Jetbrains documentation, a Resource Root enables WebStorm to complete relative paths to resources under the selected folder. This means that you should use Resource Root on a folder that holds all the resources you would like to refer to (e.g. styles, scripts, ...).
I had this problem on Mac and solved it by changing the directories properties.
- Open Preferences:
Webstorm > Preferences
- Go to Directories section in the Preferences
Project > Directories
- Add content root and Resource roots
I think this is what most people are looking for: not changing the content root, but adding a sub-folder as 'Resource Root'.
for people using IntelliJ Ultimate:
In Jet Brains WebStorm Go to File-->Settings-->Left Panel Select Project-->Click on Derectories-->Middle Panel Select Resource Root-->add the folders/Directories under your Project for reference or In the Right Panel You Can see +Add Content Root choose the directories and the Apply-->OK
It seems JetBrains IDE's recognize folders like "public' or 'www' as static serving folders and then ignore them as Ressource. When I setup a project with a bundler like vite E.g. there is no problem at all.
I had this Cannot Resolve Directory
problem on Windows for PhpStorm.
Solution:
Just go to PhpStorm and open your project.
Then right-click on the reference folder and
click mark directory -> resource root
I hope this solves your problem:)
本文标签: javascriptWebstorm quotCannot Resolve DirectoryquotStack Overflow
版权声明:本文标题:javascript - Webstorm: "Cannot Resolve Directory" - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1736818576a1954190.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论