extractus / article-extractor

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

Is it possible to enable the Require() Import ? #392

Closed Philrobots closed 1 month ago

Philrobots commented 6 months ago

Hello,

I have a typescript application and I use your tool. In my Typescript file, I import your library dynamically with the

import { extract } from “@extractus/article-extractor”;

But once the code compiles in Javascript, it converts to

const article_extractor_1 = require(“@extractus/article-extractor”);

And I get an error :

const article_extractor_1 = require("@extractus/article-extractor");

Error [ERR_REQUIRE_ESM]: require() of ES Module 

** to a dynamic import() which is available in all CommonJS modules.

Is it possible to make the import available with require like the old article-parser library?

Thanks

keypuncheralwin commented 5 months ago

Yeah, the only reason why I'm not using this package is I run into this when I build my typescipt project. I don't want to have to restructure my whole project for this one package.

@Philrobots, were you able to come up with a workaround for this?

Philrobots commented 5 months ago

Yeah, the only reason why I'm not using this package is I run into this when I build my typescipt project. I don't want to have to restructure my whole project for this one package.

@Philrobots, were you able to come up with a workaround for this?

RIght now, I use the last version that accept require import

v7.2.6

ndaidong commented 5 months ago

@Philrobots @keypuncheralwin sorry for the inconvenience. I will try to revert CJS version in the next release.

Philrobots commented 5 months ago

@Philrobots @keypuncheralwin sorry for the inconvenience. I will try to revert CJS version in the next release.

thank you very much

ivanzigoni commented 2 months ago

Yeah, the only reason why I'm not using this package is I run into this when I build my typescipt project. I don't want to have to restructure my whole project for this one package. @Philrobots, were you able to come up with a workaround for this?

RIght now, I use the last version that accept require import

v7.2.6

it worked. thanks