Open schlichtanders opened 3 months ago
Hi @schlichtanders thanks for reporting this issue. Reejs had removed support for Deno polyfill a few versions ago, due to unintended side affects.
To intentionally enable deno support, please add --deno
parameter at the end of your reejs command.
(Since you're using npx, there's need of addititonal "--" before that parameter, in order to pass the additional parameter to reejs cli)
I currently tried that and then the deno polyfills loads up, but fails with the following error:
INFO Saving important data...
ReferenceError: __dirname is not defined in ES module scope
This file is being treated as an ES module because it has a '.js' file extension and '/data/data/com.termux/files/usr/lib/node_modules/reejs/.reejs/cache/package.json' contains "type": "module". To treat it as a CommonJS script, rename it to use the '.cjs' file extension.
at https://esm.sh/v135/@deno/shim-deno@0.16.0/node/shim-deno.mjs|Node/v18.16.1 (reejs/0.17.0):109:13666
at https://esm.sh/v135/@deno/shim-deno@0.16.0/node/shim-deno.mjs|Node/v18.16.1 (reejs/0.17.0):109:458
at https://esm.sh/v135/@deno/shim-deno@0.16.0/node/shim-deno.mjs|Node/v18.16.1 (reejs/0.17.0):110:3076
at https://esm.sh/v135/@deno/shim-deno@0.16.0/node/shim-deno.mjs|Node/v18.16.1 (reejs/0.17.0):109:458
at https://esm.sh/v135/@deno/shim-deno@0.16.0/node/shim-deno.mjs|Node/v18.16.1 (reejs/0.17.0):110:4066
at https://esm.sh/v135/@deno/shim-deno@0.16.0/node/shim-deno.mjs|Node/v18.16.1 (reejs/0.17.0):109:458
at https://esm.sh/v135/@deno/shim-deno@0.16.0/node/shim-deno.mjs|Node/v18.16.1 (reejs/0.17.0):110:59466
at https://esm.sh/v135/@deno/shim-deno@0.16.0/node/shim-deno.mjs|Node/v18.16.1 (reejs/0.17.0):109:458
at https://esm.sh/v135/@deno/shim-deno@0.16.0/node/shim-deno.mjs|Node/v18.16.1 (reejs/0.17.0):110:68331
at https://esm.sh/v135/@deno/shim-deno@0.16.0/node/shim-deno.mjs|Node/v18.16.1 (reejs/0.17.0):109:458
I'll be debugging more of it later.
Here's my personal notice that explains this new error, I've already encountered it before:
__dirname
is defined in cjs, but not in mjs/esm.
esm.sh currently still cannot polyfill/fix this.
From my end/Reejs' end - it tries to polyfill dirname at the start of each file where necessary. However I either disabled that support 2 months ago (that's when I last updated reejs) or reejs failed to polyfill `dirname` from its side too.
I don't want to use deno
, but want to use npm
- hence I don't have deno
installed
In case the cli cannot be installed on npm
, it would be great to update the central website documentation to reflect this
In case the cli cannot be installed on
npm
, it would be great to update the central website documentation to reflect this
Esm.sh's original service is to serve url imports, and is not a cli focused tool. The cli you see on deno & reejs - esm.sh only manages the importmaps file, but the underlying URL imports work is done by deno & reejs themselves.
You might want to look at jspm if you have problems running either of these two.
FYI, in v136 the CLI script will be deprecated, instead a vscode extension will be released for import map updating(support index.html/importmap.json/deno.json)
You might want to look at jspm if you have problems running either of these two.
My research already pointed me to jspm (took some time to find it). Thank you for the pointer, it really solves the cli part for import maps and also supports esm.sh
Failed init
I cannot initialize esm.sh with cli on npm
Error message
After running the code in
npx reejs x https://esm.sh init
in an already npm initialized repo I got this:After running
reejs x https://esm.sh init
in a new empty folder, I got thisAdditional info
reejs doctor
report: