Angular 2\4 assets path files not found after prod build : <p>I have an Angular app and I have placed an image and custom font under assets folder(src/assets/images/bg.jpg and src/assets/fonts/segoeui.ttf).</p>

<p>I have referenced bg.jpg and segoeui.ttf in scss file, like so:</p>

<p>styles.css:</p>

<pre><code>@font-face {
    font-family: "AppFont";
    src: url("/assets/fonts/segoeui.ttf");
}

@font-face {
    font-family: "AppFont";
    src: url("/assets/fonts/segoeuib.ttf");
    font-weight: bold;
}

html,
body {
    font-family: 'AppFont', Verdana, Geneva, Tahoma, sans-serif;
}
</code></pre>

<p>login.scss:</p>

<pre><code>#login {
    background: url("/assets/images/bg.jpg");
    background-position: center;
    background-attachment: fixed;
    background-size: cover;
    height: 100vh;
}
</code></pre>

<p>And I am also using lazy loaded modules. Everything works as expected in development mode(when I run ng serve). However, when I release a prod build (ng build --prod), a dist folder is created with all js\css files. If I move these files in a virtual directory of a server, images and fonts stored in assets are pointing to root of the server, instead of pointing to the virtual directory. For example, I have project located in <code>myserver.com/myproject/index.html</code> whereas, this app looks for images in <code>myserver.com/assets/bg.jpg</code>, instead of <code>myserver.com/myproject/assets/bg.jpg</code> . Same problem with custom font too. Any idea if any of you have come across this issue? If yes, kindly let me know how to fix this. </p>

<p>Earlier, even the built js\css files were referenced from root directory and not from virtual directory. To fix this, I changed index.html from <code>&lt;base href="/"&gt;</code> to <code>&lt;base href="./"&gt;</code></p>

<p>Version details:</p>

<pre><code>@angular/cli: 1.0.1
node: 6.10.2
os: win32 x64
@angular/common: 4.1.1
@angular/compiler: 4.1.1
@angular/core: 4.1.1
@angular/forms: 4.1.1
@angular/http: 4.1.1
@angular/platform-browser: 4.1.1
@angular/platform-browser-dynamic: 4.1.1
@angular/router: 4.1.1
@angular/cli: 1.0.1
@angular/compiler-cli: 4.1.1
</code></pre>
