Open cdaringe opened 3 years ago
Did anyone got a solution for that? Tried with
--experimental-loader ./https-loader.mjs
but nothing happens
When launching
node --experimental-loader ./https-loader.mjs ./index.js
index.js code seems to route all require to https-loader but after
require = require("esm")(module)
everything is handled by ESM require function.
I tried to override the require function with the following code
require = function (file) {
console.log(file);
if (file.startsWith('https://')){
console.log('HTTPS')
return https_require(file);
}
else{
console.log('ESM')
return esm_require(file);
}
};
but all files imported via esm seems to ignore that change. I'm not an expert in the "module" variable but can't we override the resolve function for all ESM requires?
Problem
import [url]
syntax is my interest is ESM vs other module systems, and brought me to this fancy project! on attempt to import a url:Dang. Node has an experimental https loader: https://nodejs.org/api/esm.html#esm_https_loader
Is that shimmable into
standard-things/esm
?