Skip to content

Commit

Permalink
Try throwing an error if SSR and auto-CSP are both set at the same time!
Browse files Browse the repository at this point in the history
  • Loading branch information
aaronshim committed Oct 21, 2024
1 parent 82f1882 commit 5d9b563
Showing 1 changed file with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@ import { NormalizedCachedOptions } from '../normalize-cache';
import { NormalizedOptimizationOptions } from '../normalize-optimization';
import { addEventDispatchContract } from './add-event-dispatch-contract';
import { CrossOriginValue, Entrypoint, FileInfo, augmentIndexHtml } from './augment-index-html';
import { autoCsp } from './auto-csp';
import { InlineCriticalCssProcessor } from './inline-critical-css';
import { InlineFontsProcessor } from './inline-fonts';
import { addNgcmAttribute } from './ngcm-attribute';
import { addNonce } from './nonce';
import { autoCsp } from './auto-csp';

type IndexHtmlGeneratorPlugin = (
html: string,
Expand Down Expand Up @@ -95,6 +95,9 @@ export class IndexHtmlGenerator {

// Auto-CSP (as the last step)
if (options.autoCsp) {
if (options.generateDedicatedSSRContent) {
throw new Error('Cannot set both SSR and auto-CSP at the same time.');
}
this.csrPlugins.push(autoCspPlugin(options.autoCsp.unsafeEval));
}
}
Expand Down

0 comments on commit 5d9b563

Please sign in to comment.