0

Code works fine in dev mode. But not work after deploying to apache.

AppModule works, and other lazy module cannot work, link path is not same with the static files path.

Home page path is http://127.0.0.1 , and click lazy-module it will find path from /.

My js files are under static folder.

Static files loads here , e.g. browser access path is 'http://127.0.0.1/static/4-es5.js'

    D:/web/staticsites
        └─4-es5.js
        └─4-es2015.js
        └─...
        └─main-es5.js

When I click lazy-router module link console prompt

(missing: http://127.0.0.1/4-es2015.js) 

How to make angular load the path to http://127.0.0.1/static/4-es2015.js ?

Apache Config

Alias /static D:/web/staticsites
<Directory D:/web/staticsites>   
    AllowOverride None  
    Options None  
    Require all granted  
</Directory>
wgf4242
  • 775
  • 2
  • 11
  • 23
  • Possible duplicate of [What's the difference between --base-href and --deploy-url parameters of angular-cli tool](https://stackoverflow.com/questions/51182322/whats-the-difference-between-base-href-and-deploy-url-parameters-of-angular) Answer is similar to that SO Question. – penleychan Jun 24 '19 at 04:19

1 Answers1

0

Please use deploy-url while taking production build

ng build --prod --deploy-url /static/
Sajin M Aboobakkar
  • 4,051
  • 4
  • 30
  • 39