@@ -163,14 +163,8 @@ const startInlineScript = stringToPrecomputedChunk('<script>');
163163const endInlineScript = stringToPrecomputedChunk ( '</script>' ) ;
164164
165165const startScriptSrc = stringToPrecomputedChunk ( '<script src="' ) ;
166- const startScriptSrcWithNonce = stringToPrecomputedChunk ( '<script nonce="' ) ;
167- const middleScriptSrcWithNonce = stringToPrecomputedChunk ( '" src="' ) ;
168-
169166const startModuleSrc = stringToPrecomputedChunk ( '<script type="module" src="' ) ;
170- const startModuleSrcWithNonce = stringToPrecomputedChunk ( '<script nonce="' ) ;
171- const middleModuleSrcWithNonce = stringToPrecomputedChunk (
172- '" type="module" src="' ,
173- ) ;
167+ const scriptNonce = stringToPrecomputedChunk ( '" nonce="' ) ;
174168const scriptIntegirty = stringToPrecomputedChunk ( '" integrity="' ) ;
175169const endAsyncScript = stringToPrecomputedChunk ( '" async=""></script>' ) ;
176170
@@ -255,17 +249,15 @@ export function createResponseState(
255249 typeof scriptConfig === 'string' ? scriptConfig : scriptConfig . src ;
256250 const integrity =
257251 typeof scriptConfig === 'string' ? undefined : scriptConfig . integrity ;
258- if ( nonce === undefined ) {
259- bootstrapChunks . push (
260- startScriptSrc ,
261- stringToChunk ( escapeTextForBrowser ( src ) ) ,
262- ) ;
263- } else {
252+
253+ bootstrapChunks . push (
254+ startScriptSrc ,
255+ stringToChunk ( escapeTextForBrowser ( src ) ) ,
256+ ) ;
257+ if ( nonce ) {
264258 bootstrapChunks . push (
265- startScriptSrcWithNonce ,
259+ scriptNonce ,
266260 stringToChunk ( escapeTextForBrowser ( nonce ) ) ,
267- middleScriptSrcWithNonce ,
268- stringToChunk ( escapeTextForBrowser ( src ) ) ,
269261 ) ;
270262 }
271263 if ( integrity ) {
@@ -284,17 +276,16 @@ export function createResponseState(
284276 typeof scriptConfig === 'string' ? scriptConfig : scriptConfig . src ;
285277 const integrity =
286278 typeof scriptConfig === 'string' ? undefined : scriptConfig . integrity ;
287- if ( nonce === undefined ) {
288- bootstrapChunks . push (
289- startModuleSrc ,
290- stringToChunk ( escapeTextForBrowser ( src ) ) ,
291- ) ;
292- } else {
279+
280+ bootstrapChunks . push (
281+ startModuleSrc ,
282+ stringToChunk ( escapeTextForBrowser ( src ) ) ,
283+ ) ;
284+
285+ if ( nonce ) {
293286 bootstrapChunks . push (
294- startModuleSrcWithNonce ,
287+ scriptNonce ,
295288 stringToChunk ( escapeTextForBrowser ( nonce ) ) ,
296- middleModuleSrcWithNonce ,
297- stringToChunk ( escapeTextForBrowser ( src ) ) ,
298289 ) ;
299290 }
300291 if ( integrity ) {
0 commit comments