React Templating #21
|@@ -0,0 +1,25 @@|
|// Conceivably, one day I could get convert my metalsmith entry to .mjs|
|// So I can write everything in ESM. But that day is not today.|
|// A couple of problematic things I remember running into when trying it:|
|// 1. imports weren't working as expected. When doing page reloads on file changes|
|// things were reloading. The old component was still rendering the template.|
|// I think this is a feature of ESM where things are statically resolved|
|// and not dynamically called again when metalsmith runs a second time.|
|// I changed some of those pieces to do dynamic imports (import()) and that|
|// kind of worked, but if a component had a syntax error, it would get stuck|
|// in that "error" state even if i corrected it and saved again.|
|// 2. I tried using just `node --experimental-modules` but that was too limited|
|// because i couldn't get it working with @babel/register (which wasn't|
|// officially supported with experimental modules anyway)|
|// So instead I was using the `esm` package, but had problems with no.1 above|
|// plus it was actually pretty slow.|
|// require = require("esm")(module);|
|module.exports = require("./metalsmith.js");|
Oops, something went wrong.
ProTip! Use n and p to navigate between commits in a pull request.
Add this suggestion to a batch that can be applied as a single commit. This suggestion is invalid because no changes were made to the code. Suggestions cannot be applied while the pull request is closed. Suggestions cannot be applied while viewing a subset of changes. Only one suggestion per line can be applied in a batch. Add this suggestion to a batch that can be applied as a single commit. Applying suggestions on deleted lines is not supported. You must change the existing code in this line in order to create a valid suggestion. Outdated suggestions cannot be applied. This suggestion has been applied or marked resolved. Suggestions cannot be applied from pending reviews. Suggestions cannot be applied on multi-line comments.