Skip to content

Commit 9bd77f2

Browse files
fix(getHtmlWebpackPlugins): Turn off pre-render for ChatBot (#4467)
Heiko has a PR adding analytics documentation. This does not work if we try to pre-render the ChatBot with the docs framework, but works fine normally. This seems to fix the issue locally in node_modules. Here's the corresponding PR: patternfly/chatbot#441
1 parent 483f036 commit 9bd77f2

File tree

1 file changed

+10
-14
lines changed

1 file changed

+10
-14
lines changed

packages/documentation-framework/scripts/webpack/getHtmlWebpackPlugins.js

Lines changed: 10 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -5,29 +5,25 @@ const { getTitle } = require('../../helpers/getTitle');
55

66
const templateDir = path.join(__dirname, '../../templates');
77

8-
async function getHtmlWebpackPlugin({
9-
isProd,
10-
googleAnalyticsID,
11-
algolia,
12-
url,
13-
title,
14-
isFullscreen
15-
}) {
8+
async function getHtmlWebpackPlugin({ isProd, googleAnalyticsID, algolia, url, title, isFullscreen }) {
169
return new HtmlWebpackPlugin({
1710
template: path.join(templateDir, 'html.ejs'),
1811
filename: `${url}/index.html`.replace(/^\/+/, ''),
1912
templateParameters: {
2013
title: getTitle(title),
2114
// Don't prerender fullscreen pages (expensive!)
22-
prerendering: (isProd && !isFullscreen && !url.includes('topology') && !url.includes('extensions')) ? await prerender(url) : null,
15+
prerendering:
16+
isProd && !isFullscreen && !url.includes('chatbot') && !url.includes('topology') && !url.includes('extensions')
17+
? await prerender(url)
18+
: null,
2319
// Don't use GA in dev mode
2420
googleAnalyticsID: isProd ? googleAnalyticsID : false,
2521
algolia
2622
},
2723
scriptLoading: 'defer',
2824
inject: false,
2925
minify: false
30-
})
26+
});
3127
}
3228

3329
async function getHtmlWebpackPlugins(options) {
@@ -40,11 +36,11 @@ async function getHtmlWebpackPlugins(options) {
4036
filename: 'sitemap.xml',
4137
templateParameters: {
4238
urls: Object.entries(routes)
43-
.map(([path, { sources }]) => [path, ...(sources || []).slice(1).map(source => source.slug)])
39+
.map(([path, { sources }]) => [path, ...(sources || []).slice(1).map((source) => source.slug)])
4440
.flat()
4541
},
4642
inject: false,
47-
minify: false,
43+
minify: false
4844
})
4945
];
5046

@@ -59,7 +55,7 @@ async function getHtmlWebpackPlugins(options) {
5955
.map(([url, { sources = [], title, isFullscreen }]) => [
6056
[url, { title, isFullscreen }],
6157
// Add pages for sources
62-
...sources.slice(1).map(source => [source.slug, source])
58+
...sources.slice(1).map((source) => [source.slug, source])
6359
])
6460
.flat()
6561
.sort();
@@ -70,7 +66,7 @@ async function getHtmlWebpackPlugins(options) {
7066

7167
console.log('done prerendering');
7268
return res;
73-
};
69+
}
7470

7571
module.exports = {
7672
getHtmlWebpackPlugins

0 commit comments

Comments
 (0)