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

require() of ES Module node_modules/gitlog/dist/index.js from xx.js not supported. #101

Open
batchor opened this issue Aug 3, 2024 · 3 comments

Comments

@batchor
Copy link

batchor commented Aug 3, 2024

I run into this weird error. I'm not familiar with ts but it seems like some import problem with this package because all other packages are working well.

What I have in my sdk/git_cli/index.ts is:

import gitlog, { GitlogOptions } from "gitlog";

tsconfig.ts:

{
    "compilerOptions": {
      "module": "CommonJS",
      "esModuleInterop": true,
      "target": "ES2022",
      "allowJs": true,
      "removeComments": true,
      "lib": [
        "ES2022.String",
        "ES2022"
      ],
      "moduleResolution": "Node",
      "sourceMap": true,
      "skipLibCheck": true,
      "outDir": "dist",
    },
    "exclude": [
        "node_modules",
        "frontend",
        "test",
        "dist"
    ],
}
@domharrington
Copy link
Owner

Hey! What's the error you're seeing?

@batchor batchor changed the title require() of ES Module node_modules/gitlog/dist/index.js from dist/sdk/git_cli/index.js not supported. require() of ES Module node_modules/gitlog/dist/index.js from xx.js not supported. Dec 5, 2024
@batchor
Copy link
Author

batchor commented Dec 5, 2024

Hey! What's the error you're seeing?

The error message is in the title:

Error [ERR_REQUIRE_ESM]: require() of ES Module /scienhub/node_modules/gitlog/dist/index.js from xx.js not supported.

where xx.js is my ts code transpiled into CommonJS.

@domharrington
Copy link
Owner

Are you able to open up a minimal reproduction repo that I can checkout to debug this?

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

No branches or pull requests

2 participants