Skip to content

Commit

Permalink
Do not produce preRenderData when --no-prerender option is specified. (
Browse files Browse the repository at this point in the history
…#1516)

Co-authored-by: Leah <[email protected]>
  • Loading branch information
jgoamakf and ForsakenHarmony authored Feb 2, 2021
1 parent daa51ac commit 24c7473
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
5 changes: 5 additions & 0 deletions .changeset/tidy-starfishes-joke.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'preact-cli': patch
---

Do not produce preRenderData when --no-prerender option is specified.
8 changes: 5 additions & 3 deletions packages/cli/lib/resources/body-end.ejs
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
<%= htmlWebpackPlugin.options.ssr() %>
<script type="__PREACT_CLI_DATA__">
<%= encodeURI(JSON.stringify(htmlWebpackPlugin.options.CLI_DATA)) %>
</script>
<% if (htmlWebpackPlugin.options.config.prerender === true) { %>
<script type="__PREACT_CLI_DATA__">
<%= encodeURI(JSON.stringify(htmlWebpackPlugin.options.CLI_DATA)) %>
</script>
<% } %>
<% if (webpack.assets.filter(entry => entry.name.match(/bundle(\.\w{5})?.esm.js$/)).length > 0) { %>
<% /* Fix for safari < 11 nomodule bug. TODO: Do the following only for safari. */ %>
<script nomodule>!function(){var e=document,t=e.createElement("script");if(!("noModule"in t)&&"onbeforeload"in t){var n=!1;e.addEventListener("beforeload",function(e){if(e.target===t)n=!0;else if(!e.target.hasAttribute("nomodule")||!n)return;e.preventDefault()},!0),t.type="module",t.src=".",e.head.appendChild(t),t.remove()}}();</script>
Expand Down

0 comments on commit 24c7473

Please sign in to comment.