Last week I started building a portfolio website using Angular 2 created with Angular-Cli. This portfolio website is a school assignment.
one of the end requirements is that the website can run without a webserver.
When I open the website on a webserver (after building it with ng build
) I have no problem at all loading it. But when I open it locally in the browser I receive 404 file not found on each javascript file.
These javascript files are in the same directory as the index page shown below.
This is my index.hmtl generated by ng build
.
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>Hallo, ik ben Maarten.</title>
<base href="/">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="icon" type="image/x-icon" href="assets/favicon.ico">
<link href="https://fonts.googleapis.com/css?family=Open+Sans:300,400,700" rel="stylesheet">
</head>
<body>
<app-root>Loading...</app-root>
<script type="text/javascript" src="inline.js"></script>
<script type="text/javascript" src="styles.bundle.js"></script>
<script type="text/javascript" src="scripts.bundle.js"></script>
<script type="text/javascript" src="main.bundle.js"></script>
</body>
</html>
But the files aren't found when opening the index file in the browser.
Is it possible to run a Angular 2 project build with Angular-Cli without a webserver?
Thanks,
Maarten Paauw