-
-
Notifications
You must be signed in to change notification settings - Fork 32.6k
Closed as not planned
Closed as not planned
Copy link
Labels
loadersIssues and PRs related to ES module loadersIssues and PRs related to ES module loaders
Description
Version
v18.9.0
Platform
Microsoft Windows NT 10.0.19044.0 x64
Subsystem
Also tested in a Linux devcontainer (Linux docker-desktop 5.10.16.3-microsoft-standard-WSL2)
What steps will reproduce the bug?
// package.json
{
"type": "module",
"scripts": {
"start": "node server.js"
}
}
// server.js
import * as path from "path";
import * as url from "url";
const __filename = url.fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);
export const BASE_URL = new URL("http://localhost:8080");
const exports = await import(url.pathToFileURL(path.join(__dirname, "index.js")).toString());
console.log(exports); // <-- we never get here
// index.js
// The error appears to be contingent on this import:
import { BASE_URL } from "./server.js";
export async function get(request, response) {
console.log(BASE_URL);
}
How often does it reproduce? Is there a required condition?
Always.
What is the expected behavior?
The BASE_URL
gets console.log
d.
What do you see instead?
Unexpected early exit (code 13) on the dynamic import()
.
No error. Also no error if wrapped in a try...catch
.
Additional information
Originating issue: TypeStrong/ts-node#1883
Josh-Cena, avasilic, samal-rasmussen, saurabhdaware and mifi
Metadata
Metadata
Assignees
Labels
loadersIssues and PRs related to ES module loadersIssues and PRs related to ES module loaders