I am trying to export the project to production, but it only works for me when I put it in the root of the server.
If, for example, I put it on localhost/dist
it no longer works.
I have tried to modify the path with the command ng build --base-href=/dist --prod
, but, despite the fact that it modifies it, it still does not work, therefore, I understand that I am doing something wrong.
The idea is to be able to export the project to be able to use it in a path other than the server base, since I need to put it in several different folders, one per client.
I managed to make it look with him<base href="http://localhost/Proyecto/dist/">
But it doesn't link the images well, I understand that it is because the link is wrong in code, but if I run the webpack live server it looks fine (npm start)
<!doctype html>
<html lang="es">
<head>
<meta charset="utf-8">
<title>Proyecto</title>
<base href="http://localhost/Proyecto/dist/">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="icon" type="image/x-icon" href="favicon.ico">
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.2.0/css/all.css" integrity="sha384-hWVjflwFxL6sNzntih27bfxkr27PmbbK/iSvJ+a4+0owXq79v+lsFkW54bOGbiDQ" crossorigin="anonymous">
<link rel="stylesheet" href="styles.734eae50a5c982a6cd75.css">
</head>
<body>
<app-root></app-root>
<script type="text/javascript" src="runtime.a66f828dca56eeb90e02.js"></script>
<script type="text/javascript" src="polyfills.7a0e6866a34e280f48e7.js"></script>
<script type="text/javascript" src="scripts.95f63946aa03ea45d109.js"></script>
<script type="text/javascript" src="main.c686d7d3bc65f8946dda.js"></script>
</body>
</html>
I also had the same problem, the solution for me was to leave empty
base
. Namely:I hope it helps you, greetings
I have had to put the web route, with HTTPS, it works perfectly, I don't know if it is correct, but it is the only solution that has worked correctly for me.