@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.
@@ -1298,7 +1298,10 @@ const webApp = (app, ReactApp, config) => {
1298
1298
  let isRenderingJsxToString = config.renderToString || false;
1299
1299
  const bundleData = getBundleData(config, staticRoutePath);
1300
1300
  const attributes = stringifyAttributes(scripts.attributes);
1301
- scripts.startup = scripts.startup || startupScriptFilename;
1301
+ scripts.startup =
1302
+ // We don't need the startup script with SSR in development
1303
+ // as globals are baked into the client-side development bundles
1304
+ process.env.NODE_ENV === 'development' ? undefined : scripts.startup || startupScriptFilename;
1302
1305
  let responseHandler = handleResponse;
1303
1306
  if (typeof handleResponses === 'function') {
1304
1307
  responseHandler = handleResponses;
@@ -1451,7 +1454,7 @@ const webApp = (app, ReactApp, config) => {
1451
1454
 
1452
1455
  // Render the JSX server side and send response as per access method options
1453
1456
  if (!accessMethod.DYNAMIC) {
1454
- store.runSaga(rootSaga(withSagas)).toPromise().then(() => {
1457
+ store.runSaga(rootSaga(withSagas)).toPromise().then(async () => {
1455
1458
  var _selectCurrentSearch;
1456
1459
  const reduxState = store.getState();
1457
1460
  let clonedState = buildCleaner({
@@ -1531,6 +1534,13 @@ const webApp = (app, ReactApp, config) => {
1531
1534
  let title = helmet.title.toString().includes('><') ? helmetAsync.title.toString() : helmet.title.toString();
1532
1535
  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());
1533
1536
  try {
1537
+ var _config$styles, _loadableExtractor$mo, _loadableExtractor$mo2;
1538
+ // Getting style tags generated by "CSS Modules" because they will be
1539
+ // available to loadable stats if we have built parts of the app with CSS
1540
+ // plugins that are not within styled-components
1541
+ // Render inline styles for CSS Modules if configured
1542
+ 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();
1543
+
1534
1544
  /**
1535
1545
  * Loads all page assets into the provided templateHTML
1536
1546
  *
@@ -1541,7 +1551,6 @@ const webApp = (app, ReactApp, config) => {
1541
1551
  * if the context has requested a redirect
1542
1552
  * */
1543
1553
  const getContextHtml = (isFinal = false, styleTags, renderedJsxMarkup) => {
1544
- var _loadableExtractor$mo;
1545
1554
  if (context.url) {
1546
1555
  response.redirect(context.statusCode || 302, context.url);
1547
1556
  return '';
@@ -1556,18 +1565,13 @@ const webApp = (app, ReactApp, config) => {
1556
1565
  // Set response.status from React StaticRouter
1557
1566
  if (typeof context.statusCode === 'number') response.status(context.statusCode);
1558
1567
  const bundleTags = isFinal ? getBundleTags(loadableExtractor, scripts, staticRoutePath) : '';
1559
-
1560
- // Getting style tags generated by "CSS Modules" because they will be
1561
- // available to loadable stats if we have built parts of the app with CSS
1562
- // plugins that are not within styled-components
1563
- const styles = loadableExtractor === null || loadableExtractor === void 0 || (_loadableExtractor$mo = loadableExtractor.modern) === null || _loadableExtractor$mo === void 0 ? void 0 : _loadableExtractor$mo.getStyleTags();
1564
1568
  const html = replaceHtml({
1565
1569
  bundleTags,
1566
1570
  html: renderedJsxMarkup,
1567
1571
  htmlAttributes,
1568
1572
  metadata,
1569
1573
  state: serialisedReduxData,
1570
- styleTags: `${styleTags || ''}${styles || ''}`,
1574
+ styleTags: `${styleTags || ''}${cssModuleStyles || ''}`,
1571
1575
  title,
1572
1576
  templateHTML,
1573
1577
  templateHTMLFragment,