pull/6/head
janwirth 3 years ago
parent d078b1de6e
commit 1b02c09101

@ -4,8 +4,8 @@ const babelCore = require("@babel/core");
const Module = require("module").Module;
const fs = require("fs");
function transpile(code) {
return babelCore.transformSync(code, {
function transpile(code, filename) {
return babelCore.transformSync(code, {filename,
plugins: [
require.resolve("@babel/plugin-proposal-export-namespace-from"),
require.resolve("@babel/plugin-transform-modules-commonjs")
@ -28,7 +28,7 @@ module.exports = {
if (error.code === "ERR_REQUIRE_ESM") {
// NOTE: We completely bypass the default internal loader, as we cannot patch the `type: module` check out of that. Please open a PR if you have a better solution!
let code = fs.readFileSync(filename, "utf8");
let transpiledCode = transpile(code);
let transpiledCode = transpile(code, filename);
mod._compile(transpiledCode.code, filename);
} else {
throw error;

Loading…
Cancel
Save