We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent dff85b2 commit 2d32b5dCopy full SHA for 2d32b5d
src/server/template-renderer/index.js
@@ -191,10 +191,13 @@ export default class TemplateRenderer {
191
contextKey = 'state',
192
windowKey = '__INITIAL_STATE__'
193
} = options || {}
194
+ const autoRemove = process.env.NODE_ENV === 'production'
195
+ ? '(function(){var s;(s=document.currentScript||document.scripts[document.scripts.length-1]).parentNode.removeChild(s);}());'
196
+ : ''
197
return context[contextKey]
198
? `<script>window.${windowKey}=${
199
serialize(context[contextKey], { isJSON: true })
- }</script>`
200
+ }${autoRemove}</script>`
201
: ''
202
}
203
0 commit comments