0

Man! What's wrong with Angular? or Node? I can't figure out why I can no longer create simple js and css files and call them inside the "index.html" file! When I call them from "index.html" file, the autocompletion works fine and points to their correct paths.. But when I hover on their path holding "ctrl" button to open them, Visual Studio Code can't find them!! Wait, whaaaat? You just suggested me the correct path! When I try to build the project, I find the output dist in a hell of disorder: some images are in the root folder, and some others are in "/assets/img" folder.. When I deploy the output folder to the server, it can't even point to the basic js and css files!

I even tried to create a new blank project, and a file called "app.js" in the same level as "index.html", I just have put a "console.log" instruction inside the "app.js" and then call it in the "index.html" with:

<script src="app.js"></script>

and

<script src="./app.js"></script>

but none of them seems to work! it searches for the file in a one level up from the src folder, not INSIDE the src folder! It usually works fine, I don't know what happened with Angular..

By the way, I tried this on 2 different PCs, with 2 different Angular versions (8 and 7), and 2 different code editors, I even uninstalled and re-installed the latest version of Node.js and cleaned the cache, and whatever new project I create on both PCs, I face the same problem!

Here is a sample project path on github: Angular issue

Any Ideas about what it could be? Thank you!

1 Answers1

0

i got stuck in this problem somethimes to, and change the

<base href="/">  to  <base href="./"> or even <base href="../"> 

resolve the issue, also change when establish the call and change it to ../../ at the beggining of the calls, the intellisense dont recognizes the path, but stills works for me. well this solution sometime help me, let me kwon what happens