-
-
Notifications
You must be signed in to change notification settings - Fork 542
Open
Description
Search Terms
esm, external, exports, wildcard, extension
Expected Behavior
If a package defines an exports field
// foo_pkg/package.json
"exports": {
"./*.js": "./dist/*.js"
}And a consuming package imports:
// src/import_foo.ts
import { foo } from "foo_pkg/foo.js";
console.log(foo);The program should compile and execute with ts-node-esm.
Actual Behavior
An ERR_PACKAGE_PATH_NOT_EXPORTED exception is raised.
Steps to reproduce the problem
I have made a branch on a repo to reproduce this issue.
Minimal reproduction
git clone --single-branch --branch ts_node_import_err https://github.com/jm4rtinez/ts_node_sandbox.git
npm install
npx ts-node-esm ./src/import_foo.tsIf the compiled form of the program is run with Node, no error occurs:
node ./dist/import_foo.jsSpecifications
- ts-node version: 10.9.1
- node version: 19.2.0
- TypeScript version: 4.9.4
- tsconfig.json, if you're using one:
{
"compilerOptions": {
"target": "ES2022",
"module": "ES2022",
"moduleResolution": "NodeNext",
"declaration": true,
"declarationMap": true,
"sourceMap": true,
"strict": true,
"outDir": "dist"
},
"include": ["src"]
}
- package.json:
{
"name": "ts-node-sandbox",
"version": "1.0.0",
"description": "",
"type": "module",
"scripts": {},
"author": "",
"license": "ISC",
"devDependencies": {
"ts-node": "^10.9.1",
"typescript": "~4.9"
},
"dependencies": {
"foo_pkg": "file:foo_pkg-1.0.0.tgz"
}
}
- Operating system and version: Windows 10 Pro Version 10.0.19045 Build 19045
- If Windows, are you using WSL or WSL2?: WSL2 Ubuntu 20.04.5 LTS
rzyns, BenceSzalai, alexilyaev, jpb06 and Knifa
Metadata
Metadata
Assignees
Labels
No labels