Reputation: 5368
I want to serve my Angular 2 application from a relative path, however I'm running into issues with how the angular-cli generates the index.html page.
The CLI inserts script references but because a leading slash isn't included, the html base
tag doesn't prefix the requests. EX of current cli output:
<script type="text/javascript" src="inline.bundle.js"></script>
<script type="text/javascript" src="vendor.bundle.js"></script>
<script type="text/javascript" src="main.bundle.js"></script>
What I want is for the CLI to allow me to customize this path. EX:
<script type="text/javascript" src="/myapp/inline.bundle.js"></script>
<script type="text/javascript" src="/myapp/vendor.bundle.js"></script>
<script type="text/javascript" src="/myapp/main.bundle.js"></script>
Is this possible with the CLI? The server that is hosting these files cannot use these default paths the way they're specified in the index.html page.
Upvotes: 7
Views: 1755
Reputation: 21
You can use the parameter deploy-url param in angular-cli.json. If you put text 'app' to this param, you get paths like 'app/inline.bundle.js' in your index.html file.
Upvotes: 2