diff --git a/src/server/template-renderer/index.js b/src/server/template-renderer/index.js index 48aa0caa..680e1713 100644 --- a/src/server/template-renderer/index.js +++ b/src/server/template-renderer/index.js @@ -191,10 +191,13 @@ export default class TemplateRenderer { contextKey = 'state', windowKey = '__INITIAL_STATE__' } = options || {} + const autoRemove = process.env.NODE_ENV === 'production' + ? '(function(){var s;(s=document.currentScript||document.scripts[document.scripts.length-1]).parentNode.removeChild(s);}());' + : '' return context[contextKey] ? `` + }${autoRemove}` : '' }