mirror of
https://github.com/angular/angular-cli.git
synced 2025-05-19 04:22:53 +08:00
fix(@angular/cli): baseHref to accept empty string via cli
This commit is contained in:
parent
c6bba521ab
commit
52f9b80f08
@ -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);
|
||||
});
|
||||
});
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user