UNPKG

resolve-runtime

Version:
37 lines (28 loc) 1.59 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.default = void 0; var _reactHelmet = require("react-helmet"); var _json_utf_stringify = _interopRequireDefault(require("../utils/json_utf_stringify")); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } var _default = ({ reducers, seedClientEnvs, markup, styleTags, initialState, bundleUrl, faviconUrl // TODO. Revert HMR before 0.18.0. Local Server with HMR / Cloud Server without HMR // hmrUrl }) => { const helmet = _reactHelmet.Helmet.renderStatic(); for (const reducerName of Object.keys(reducers)) { delete initialState[reducerName]; } return `<!doctype html>` + `<html ${helmet.htmlAttributes.toString()}>` + '<head>' + `<link rel="icon" type="image/x-icon" href="${faviconUrl}" />` + `${helmet.title.toString()}` + `${helmet.meta.toString()}` + `${helmet.link.toString()}` + `${helmet.style.toString()}` + styleTags + '<script>' + `window.__INITIAL_STATE__=${(0, _json_utf_stringify.default)(initialState)};` + `window.__RESOLVE_RUNTIME_ENV__=${(0, _json_utf_stringify.default)(seedClientEnvs)};` + '</script>' + `${helmet.script.toString()}` + '</head>' + `<body ${helmet.bodyAttributes.toString()}>` + `<div class="app-container">${markup}</div>` + `<script src="${bundleUrl}"></script>` + // TODO. Revert HMR before 0.18.0. Local Server with HMR / Cloud Server without HMR // `<script src="${hmrUrl}"></script>` + '</body>' + '</html>'; }; exports.default = _default; //# sourceMappingURL=get_html_markup.js.map