Closed maxcell closed 2 years ago
Seems like the issue might have been introduced in be22c5f6b329c9552f51cd63ece6108c58833d3e, which loads netlify-cms from unpkg instead of the included cms.js
file:
--- a/src/cms.html
+++ b/site/static/admin/index.html
@@ -9,6 +9,6 @@
<script src="https://identity-js.netlify.com/v1/netlify-identity-widget.js"></script>
</head>
<body>
- <script src="<%= htmlWebpackPlugin.files.chunks.cms.entry %>"></script>
+ <script src="https://unpkg.com/netlify-cms@^2.0.0/dist/netlify-cms.js"></script>
</body>
</html>
I was able to get a fix working on my site -- here are the changes pulled out into a commit https://github.com/cgc/one-click-hugo-cms/commit/97a313e84f0273dd71932c2efa168a05be0246b7. They deal with breaking changes in two packages during the version updates in #674:
date-fns
- format strings changed in 2.0, the release notes have a table of changes herehtml-webpack-plugin
- htmlWebpackPlugin.files
has a new format that disappointingly discards bundle names between 3.x and 4.x (documented in project readme, search for "htmlWebpackPlugin.files
"). The change is a bit annoying because it means you have to assume the order of bundles. Since object property order is based on insertion order (in ES6), as long as that order isn't modified by webpack, the index in my commit is appropriate for the order of bundles in webpack.common.js
(empirically, it also works). An issue to reverse this change (so, to once again access bundles by name) has been opened but is stale: https://github.com/jantimon/html-webpack-plugin/issues/1369.
Summary
Looks like when I upgraded all of our dependencies and fixed up some breaking changes in #674, I also broke the Preview Template feature. Fortunately this doesn't stop it from rendering properly once you've published your post in the editor, just need to find a way to bring the
src/js/cms.js
files into oursite/static/admin/index.html
.Steps to Reproduce
To reproduce this you need to go into the NetlifyCMS (
/admin
) and see any page or post.Expected Behavior
We should expect the current output as the current preview, with the same styling and everything we're using.