Reputation: 3092
When doing a build:
ng build --prod --aot=false
It always puts in a <base href>
in the index.html in the dist folder. Is there a way I can prevent this?
Upvotes: 1
Views: 849
Reputation: 135792
To not get <base href="/">
on the dist index.html
, remove it from the src/index.html
file:
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>PROJECTNAME</title>
<base href="/">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="icon" type="image/x-icon" href="favicon.ico">
</head>
...
Should be, then:
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>PROJECTNAME</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="icon" type="image/x-icon" href="favicon.ico">
</head>
...
ng build
--base-href
flagIt is important to notice that the ng build
command has a --base-href
(or --bh
) flag, but it only works for changing the href
attribute (if it exists) or adding it (if it doesn't exist). It doesn't allow you to remove it.
Upvotes: 3