@zengenti/contensis-react-base 4.0.1-beta.1 → 4.0.1-beta.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1316,7 +1316,10 @@ const webApp = (app, ReactApp, config) => {
1316
1316
  let isRenderingJsxToString = config.renderToString || false;
1317
1317
  const bundleData = getBundleData(config, staticRoutePath);
1318
1318
  const attributes = stringifyAttributes(scripts.attributes);
1319
- scripts.startup = scripts.startup || startupScriptFilename;
1319
+ scripts.startup =
1320
+ // We don't need the startup script with SSR in development
1321
+ // as globals are baked into the client-side development bundles
1322
+ process.env.NODE_ENV === 'development' ? undefined : scripts.startup || startupScriptFilename;
1320
1323
  let responseHandler = handleResponse;
1321
1324
  if (typeof handleResponses === 'function') {
1322
1325
  responseHandler = handleResponses;
@@ -1469,7 +1472,7 @@ const webApp = (app, ReactApp, config) => {
1469
1472
 
1470
1473
  // Render the JSX server side and send response as per access method options
1471
1474
  if (!accessMethod.DYNAMIC) {
1472
- store$1.runSaga(App.rootSaga(withSagas)).toPromise().then(() => {
1475
+ store$1.runSaga(App.rootSaga(withSagas)).toPromise().then(async () => {
1473
1476
  var _selectCurrentSearch;
1474
1477
  const reduxState = store$1.getState();
1475
1478
  let clonedState = lodashClean.buildCleaner({
@@ -1549,6 +1552,13 @@ const webApp = (app, ReactApp, config) => {
1549
1552
  let title = helmet.title.toString().includes('><') ? helmetAsync.title.toString() : helmet.title.toString();
1550
1553
  const metadata = helmetAsync.meta.toString().concat(helmetAsync.base.toString()).concat(helmetAsync.priority.toString()).concat(helmetAsync.link.toString()).concat(helmetAsync.script.toString()).concat(helmetAsync.noscript.toString()).concat(helmet.meta.toString()).concat(helmet.base.toString()).concat(helmet.link.toString()).concat(helmet.script.toString()).concat(helmet.noscript.toString());
1551
1554
  try {
1555
+ var _config$styles, _loadableExtractor$mo, _loadableExtractor$mo2;
1556
+ // Getting style tags generated by "CSS Modules" because they will be
1557
+ // available to loadable stats if we have built parts of the app with CSS
1558
+ // plugins that are not within styled-components
1559
+ // Render inline styles for CSS Modules if configured
1560
+ const cssModuleStyles = (_config$styles = config.styles) !== null && _config$styles !== void 0 && _config$styles.inline ? await (loadableExtractor === null || loadableExtractor === void 0 || (_loadableExtractor$mo = loadableExtractor.modern) === null || _loadableExtractor$mo === void 0 ? void 0 : _loadableExtractor$mo.getInlineStyleTags()) : loadableExtractor === null || loadableExtractor === void 0 || (_loadableExtractor$mo2 = loadableExtractor.modern) === null || _loadableExtractor$mo2 === void 0 ? void 0 : _loadableExtractor$mo2.getStyleTags();
1561
+
1552
1562
  /**
1553
1563
  * Loads all page assets into the provided templateHTML
1554
1564
  *
@@ -1559,7 +1569,6 @@ const webApp = (app, ReactApp, config) => {
1559
1569
  * if the context has requested a redirect
1560
1570
  * */
1561
1571
  const getContextHtml = (isFinal = false, styleTags, renderedJsxMarkup) => {
1562
- var _loadableExtractor$mo;
1563
1572
  if (context.url) {
1564
1573
  response.redirect(context.statusCode || 302, context.url);
1565
1574
  return '';
@@ -1574,18 +1583,13 @@ const webApp = (app, ReactApp, config) => {
1574
1583
  // Set response.status from React StaticRouter
1575
1584
  if (typeof context.statusCode === 'number') response.status(context.statusCode);
1576
1585
  const bundleTags = isFinal ? getBundleTags(loadableExtractor, scripts, staticRoutePath) : '';
1577
-
1578
- // Getting style tags generated by "CSS Modules" because they will be
1579
- // available to loadable stats if we have built parts of the app with CSS
1580
- // plugins that are not within styled-components
1581
- const styles = loadableExtractor === null || loadableExtractor === void 0 || (_loadableExtractor$mo = loadableExtractor.modern) === null || _loadableExtractor$mo === void 0 ? void 0 : _loadableExtractor$mo.getStyleTags();
1582
1586
  const html = replaceHtml({
1583
1587
  bundleTags,
1584
1588
  html: renderedJsxMarkup,
1585
1589
  htmlAttributes,
1586
1590
  metadata,
1587
1591
  state: serialisedReduxData,
1588
- styleTags: `${styleTags || ''}${styles || ''}`,
1592
+ styleTags: `${styleTags || ''}${cssModuleStyles || ''}`,
1589
1593
  title,
1590
1594
  templateHTML,
1591
1595
  templateHTMLFragment,