Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

swc-node does not work if npm package ends with ".js" #865

Open
Xinkai opened this issue Oct 31, 2024 · 0 comments
Open

swc-node does not work if npm package ends with ".js" #865

Xinkai opened this issue Oct 31, 2024 · 0 comments

Comments

@Xinkai
Copy link
Contributor

Xinkai commented Oct 31, 2024

The following code does not work. Full minimal reproduce repo: https://github.com/Xinkai/swc-node-minio-reproduce

import { Client } from "minio";

const client = new Client({
    accessKey: "123",
    secretKey: "123",
    endPoint: "example.com",
});
node --import @swc-node/register/esm-register src/main.ts

node:internal/modules/run_main:122
    triggerUncaughtException(
    ^
Error: Cannot resolve 'ipaddr.js' for extension aliases 'ipaddr.ts,ipaddr.tsx,ipaddr.js' in '/home/xinkai/projects/Web/swc-node-minio-reproduce/node_modules/.pnpm/[email protected]/node_modules/minio/node_modules': ipaddr.js cannot be resolved in file:///home/xinkai/projects/Web/swc-node-minio-reproduce/node_modules/.pnpm/[email protected]/node_modules/minio/dist/esm/internal/helper.mjs
    at resolve (file:///home/xinkai/projects/Web/swc-node-minio-reproduce/node_modules/.pnpm/@[email protected]_@[email protected]_@[email protected][email protected]/node_modules/@swc-node/register/esm/esm.mjs:157:15)
    at async nextResolve (node:internal/modules/esm/hooks:748:22)
    at async Hooks.resolve (node:internal/modules/esm/hooks:240:24)
    at async handleMessage (node:internal/modules/esm/worker:199:18)

Node.js v22.10.0

I found #817 and #824, but I don't think they fixed this problem.

Node: v22.10
@swc-node/register: 1.10.9

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

1 participant