Skip to content

Commit 5d9b563

Browse files
committed
Try throwing an error if SSR and auto-CSP are both set at the same time!
1 parent 82f1882 commit 5d9b563

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

packages/angular/build/src/utils/index-file/index-html-generator.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,11 @@ import { NormalizedCachedOptions } from '../normalize-cache';
1212
import { NormalizedOptimizationOptions } from '../normalize-optimization';
1313
import { addEventDispatchContract } from './add-event-dispatch-contract';
1414
import { CrossOriginValue, Entrypoint, FileInfo, augmentIndexHtml } from './augment-index-html';
15+
import { autoCsp } from './auto-csp';
1516
import { InlineCriticalCssProcessor } from './inline-critical-css';
1617
import { InlineFontsProcessor } from './inline-fonts';
1718
import { addNgcmAttribute } from './ngcm-attribute';
1819
import { addNonce } from './nonce';
19-
import { autoCsp } from './auto-csp';
2020

2121
type IndexHtmlGeneratorPlugin = (
2222
html: string,
@@ -95,6 +95,9 @@ export class IndexHtmlGenerator {
9595

9696
// Auto-CSP (as the last step)
9797
if (options.autoCsp) {
98+
if (options.generateDedicatedSSRContent) {
99+
throw new Error('Cannot set both SSR and auto-CSP at the same time.');
100+
}
98101
this.csrPlugins.push(autoCspPlugin(options.autoCsp.unsafeEval));
99102
}
100103
}

0 commit comments

Comments
 (0)