fix(@angular/cli): baseHref to accept empty string via cli

This commit is contained in:
sendilkumarn 2017-08-02 19:02:00 +08:00 committed by Filipe Silva
parent c6bba521ab
commit 52f9b80f08
2 changed files with 16 additions and 1 deletions

View File

@ -63,4 +63,19 @@ describe('base href webpack plugin', () => {
});
plugin.apply(compiler);
});
it('should replace href attribute when baseHref is empty', function () {
const plugin = new BaseHrefWebpackPlugin({ baseHref: '' });
const compiler = mockCompiler(oneLineTrim`
<head><base href="/" target="_blank"></head>
<body></body>
`, (_x: any, htmlPluginData: any) => {
expect(htmlPluginData.html).toEqual(oneLineTrim`
<head><base href="" target="_blank"></head>
<body></body>
`);
});
plugin.apply(compiler);
});
});

View File

@ -7,7 +7,7 @@ export class BaseHrefWebpackPlugin {
apply(compiler: any): void {
// Ignore if baseHref is not passed
if (!this.options.baseHref) {
if (!this.options.baseHref && this.options.baseHref !== '') {
return;
}