angular-cli icon indicating copy to clipboard operation
angular-cli copied to clipboard

Incorrect JS paths when ng build -prod is deployed in a subfolder

Open jarben opened this issue 10 years ago • 43 comments

Please provide us with the following information:

  1. OS?
    Windows 10
  1. Versions: angular-cli: 1.0.0-beta.5 node: 4.4.5 os: win32 x64
  2. Repro steps:
  • Fresh app created by "ng new datamatic"
  • Then build "ng build prod"
  • /dist folder deployed to http://datamatic.co/angular2-test/
  1. The log given by the failure: Browser log when accessing http://datamatic.co/angular2-test/: image

Files are loaded relative to the domain, not the folder

jarben avatar Jun 14 '16 14:06 jarben

@MarcoHeumann but that would introduce the problem in reloading the page. Because when reloading it uses the current path as the base path. I am having the same issue. I still haven't figured out the clean and permanent solution. Though if you don't care about deploying to different paths or folders, there are two ways with absolute path: update base-href in index.html after war file is built or use it in ng build -base-href command.

amittal1 avatar Apr 26 '19 15:04 amittal1

This will work

aj-amelio311 avatar Jun 09 '19 22:06 aj-amelio311

This issue has been automatically locked due to inactivity. Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.