Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings
forked fromvuejs/vue

Commit2d32b5d

Browse files
markbrouchyyx990803
authored andcommitted
feat(ssr): auto-remove initial state script if prod (vuejs#6763)
closevuejs#6761
1 parentdff85b2 commit2d32b5d

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

‎src/server/template-renderer/index.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -191,10 +191,13 @@ export default class TemplateRenderer {
191191
contextKey='state',
192192
windowKey='__INITIAL_STATE__'
193193
}=options||{}
194+
constautoRemove=process.env.NODE_ENV==='production'
195+
?'(function(){var s;(s=document.currentScript||document.scripts[document.scripts.length-1]).parentNode.removeChild(s);}());'
196+
:''
194197
returncontext[contextKey]
195198
?`<script>window.${windowKey}=${
196199
serialize(context[contextKey],{isJSON:true})
197-
}</script>`
200+
}${autoRemove}</script>`
198201
:''
199202
}
200203

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp