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

Cannot use require to use the module #20

Open
huy19th opened this issue Oct 7, 2024 · 1 comment
Open

Cannot use require to use the module #20

huy19th opened this issue Oct 7, 2024 · 1 comment

Comments

@huy19th
Copy link

huy19th commented Oct 7, 2024

I'm using typescript for my project and when it compiles, import() statement was converted to require() so i ran into this error

D:\Git\comic-ocr-translation-web\dist\modules\ocr-translation\ocr-translation.service.js:12
const chrome_lens_ocr_1 = require("chrome-lens-ocr");
^

Error [ERR_REQUIRE_ESM]: require() of ES Module D:\Git\comic-ocr-translation-web\node_modules\chrome-lens-ocr\src\index.js from D:\Git\comic-ocr-translation-web\dist\modules\ocr-translation\ocr-translation.service.js not supported.
Instead change the require of index.js in D:\Git\comic-ocr-translation-web\dist\modules\ocr-translation\ocr-translation.service.js to a dynamic import() which is available in all CommonJS modules.
at Object. (D:\Git\comic-ocr-translation-web\dist\modules\ocr-translation\ocr-translation.service.js:12:27) {
code: 'ERR_REQUIRE_ESM'
}

@dimdenGD
Copy link
Owner

dimdenGD commented Oct 7, 2024

Make it compile to ESM instead

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