I have a simple web application in Angular v5. This is a purely client-side application in the meaning of it doesn't use any server-side (this is a basic calculator application that load data from JSON file with some measurements and display to the user some analysis according to that JSON).
During development I've tested the application using the Angular-cli "serve", by running - ng serve
command, and it works great.
Now I wont to bundle my app and start using it. I would like to run this app locally on my machine without any server.
According to the Angular documentation, to bundle the application to deployment, I should run the command: ng build --prod --base-href=./
. There to flag --prod
will deploy a minified and uglified version of the application. And the --base-href=./
will set <base href="./">
in the index.html to allow me loading the application files (all the ABC.bundles.js file) directly from the local machine.
Now, when I'm opening the dist/index.html
file I can see that all the scripts have loaded, however, I have an error in the console:
ERROR Error: Uncaught (in promise): SecurityError: Failed to execute 'replaceState' on 'History': A history state object with URL 'file:///C:/.../dist/' cannot be created in a document with origin 'null' and URL 'file:///C:/.../dist/index.html'.
How do I deploy/bundle my application to run locally, without a server?