Node.js requires a custom https-loader: https://nodejs.org/api/esm.html#https-loader
The loader (https-loader.js):
The sample file (sample.js):
export const example = () => ({ foo: "bar" });The test snippet (index.js):
import { example } from "https://gist.githubusercontent.com/o-az/e8ed1e89fde52af306099ed28e297cae/raw/51a1d68f54ba0718c2ab72a52b97f13cf613563f/sample.js";
console.log(example());The command:
| Runtime | Command |
|---|---|
Node.js |
node --experimental-loader='./https-loader.js' index.js |
Deno |
deno run --allow-net index.js |