Closed trusktr closed 1 year ago
Oh, that makes sense, because it is piped into the command, Node has no idea what the URL is.
If I rename it to .mjs
and run it like so it works:
node --experimental-import-meta-resolve ./dev-server.mjs
I must be missing something simple. How do we run a regular .js
file as esm?
I must be missing something simple. How do we run a regular
.js
file as esm?
Add "type": "module"
to the nearest parent package.json
. If you have further questions please use https://github.com/nodejs/help, this repo is for the team developing the modules implementation.
It'd be great if node --input-type module ./dev-server.js
just worked, as intuition would expect.
I'm running a file like this:
And inside that file we have this:
and this is the output: