1
votes

I am using angular cli for my angular 2 application. After npm run build, dist folder is created. When I open index.html of dist folder, it cannot find files like inline.bundle.js, polyfills.bundle.js etc. I need to give an absolute path for these files so that I can run my project. Please help.

2
In order to build angular cli project, you should run ng build command. - Darshita
@Darshita I have built the project. The relative path of mentioned files are the issue. - Keshav Dhawan
Have you published your dist folder? - Darshita
@Darshita not really. Can you please elaborate? - Keshav Dhawan
possibly your problem related with base href. check the cli --base-href option - Ravin Singh D

2 Answers

2
votes

TO RESOLVE THIS ISSUE OF PROVIDING THE ABSOLUTE PATH

Please use the command below to generate the build of project using angular cli

Command for the dev build

ng build --base-href ./

for the production build

ng build --prod --base-href ./

Base-href is used to notify the path of js file located at.

1
votes

I used this and working fine:

ng build --base-href 'SERVER_APPLICATION_PATH'

LIKE AS

ng build --base-href 'http://localhost/web/angular-first/'