Setting base HTML tag makes Webstorm incapable of figuring out URLs

See attached image below.

My directory structure is like this:

src\index.html
src\app\restOfApplication.js // All application files should be in src\app
src\bower_components // All library files are placed here.

Setting the base tag in the head tag to 'app/' makes webstorm unable to figure out URLs. On line 18 in the image, you see that I have removed the '../'. Webstorm now finds the file, but when running the application, I get an error that the file cannot be found, naturally as the URL as been rightfully rewritten.

If there was some way to make Webstorm understand the 'base' tag, or adjust where to find files, it would be perfect. Does anybody know how to do this?

WebstormBaseUrl.PNG

2 comments
Comment actions Permalink

Hi there,

AFAIK IDE does not take <base> tag into account (but I could be wrong here as I have never used it myself this way) -- it checks URLs/resources against project root.

But you can mark specific folder as Resource Root ("Settings | Directories" .. or via context menu in Project View) and this folder will be treated as possible root when resolving URLs (you may have multiple resource roots) -- should work (although not 100% sure for your specific case -- need some sample project to verify).

What about using URLs relative to the website root (starting with leading slash, e.g. "/bower_components/...") ?

0
Comment actions Permalink

Thank you very much. Setting 'app' folder as resource root solved the problem.

0

Please sign in to leave a comment.