extractus / article-extractor

To extract main article from given URL with Node.js
https://extractor-demos.pages.dev/article-extractor
MIT License
1.56k stars 134 forks source link

Error [ERR_REQUIRE_ESM]: require() of ES Module >=8.0.2 #366

Closed BertrandBev closed 12 months ago

BertrandBev commented 1 year ago

360 Was resolved with 7.3.1 but seems broken again in 8.0.2

ndaidong commented 1 year ago

@BertrandBev yes. since v8.0, we stopped generating commonjs version.

habibredissi commented 1 year ago

@ndaidong We're experiencing the same error. Do you know how to fix it for a (NodeJs + TypeScript) project.

tsconfig.json

{
  "compilerOptions": {
    "baseUrl": "./",
    "target": "ES2018",
    "module": "commonjs",
    "jsx": "react-jsx",
    "outDir": "./dist",
    "strict": true,
    "noEmit": true,
    "lib": ["es2015"],
    "esModuleInterop": true,
    "skipLibCheck": true,
    "forceConsistentCasingInFileNames": true
  },
  "ts-node": {
    "require": ["tsconfig-paths/register"]
  }
}

package.json: "start": "ts-node -T src/server.ts | bunyan",

THANKS!!

ndaidong commented 1 year ago

@habibredissi It's the time to switch completely to ESM, which you can safely use everywhere, from Node, Deno, Bun platfrom to the browsers.