htmdx
htmdx copied to clipboard
Not compatible with raw ESM in node
index.js
import {htmdx} from "htmdx";
console.log({htmdx});
package.json
{
"name": "poop",
"version": "1.0.0",
"main": "index.js",
"type": "module",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"dependencies": {
"htmdx": "^0.3.7"
}
}
Running node index.js produces the following error.
/Users/briankim/Clones/poop/node_modules/xhtm/index.js:1
import htm from './htm'
^^^^^^
SyntaxError: Cannot use import statement outside a module
at Object.compileFunction (node:vm:352:18)
at wrapSafe (node:internal/modules/cjs/loader:1031:15)
at Module._compile (node:internal/modules/cjs/loader:1065:27)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1153:10)
at Module.load (node:internal/modules/cjs/loader:981:32)
at Function.Module._load (node:internal/modules/cjs/loader:822:12)
at Module.require (node:internal/modules/cjs/loader:1005:19)
at require (node:internal/modules/cjs/helpers:102:18)
at Object.<anonymous> (/Users/briankim/Clones/poop/node_modules/htmdx/dist/htmdx.cjs.development.js:9:27)
at Module._compile (node:internal/modules/cjs/loader:1101:14)
There are ways to fix this but I’ve temporarily forgotten how to do it. Happy to help if you want this to be fixed.