diff --git a/packages/core/src/server.jsx b/packages/core/src/server.jsx index e5161ce4d..f987cf12b 100644 --- a/packages/core/src/server.jsx +++ b/packages/core/src/server.jsx @@ -35,12 +35,12 @@ const baseTag = process.env.CANON_BASE_URL === undefined ? "" /** Returns the default server logic for rendering a page. */ -export default function (defaultStore = appInitialState, headerConfig, reduxMiddleware = false) { +export default function(defaultStore = appInitialState, headerConfig, reduxMiddleware = false) { - return function (req, res) { + return function(req, res) { const locale = req.i18n.language, - resources = req.i18n.getResourceBundle(req.i18n.language); + resources = req.i18n.getResourceBundle(req.i18n.language); const windowLocation = { basename, @@ -120,8 +120,8 @@ export default function (defaultStore = appInitialState, headerConfig, reduxMidd const helmetContext = {}; let componentHTML, - scriptTags = "", - styleTags = ""; + scriptTags = "", + styleTags = ""; if (production) { @@ -195,7 +195,7 @@ export default function (defaultStore = appInitialState, headerConfig, reduxMidd styleTags = styleTags.replace(/\/assets\//g, "assets/"); } - const serialize = obj => `JSON.parse('${jsesc(JSON.stringify(obj))}')`; + const serialize = obj => `JSON.parse('${jsesc(JSON.stringify(obj), {isScriptContext: true})}')`; return res.status(status).send(`