PaddlePaddle / PaddlePaddle/FastDeploy

Error [ERR_REQUIRE_ESM]: require() of ES Module d3-polygon from @paddle-js-models\ocr not supported

Open
#2,462 2 comments 1 reaction 1 assignee View on GitHub

@rainyfly is already working on this.

Since May 28, 2024.

Dominant language
Python
Stars
3.7k
Forks
756
Avg merge
19h 28m
Merged PRs (30d)
4

Description

Environment

Paddle OCR JS

  1. Using this create sveltekit app
npm create vite@latest
  1. Install paddlejs
npm i "@paddlejs/paddlejs-core"
npm i "@paddle-js-models/ocr"
  1. Use in app in Counter.svelte
import * as ocr from "@paddle-js-models/ocr";

Now following error occurs.

Problem description

Please attach the log file if there's problem happend.

Error [ERR_REQUIRE_ESM]: require() of ES Module C:\Projects\ocr-test\node_modules\d3-polygon\src\index.js from C:\Projects\ocr-test\node_modules\@paddle-js-models\ocr\lib\index.js not supported.
Instead change the require of C:\Projects\ocr-test\node_modules\d3-polygon\src\index.js in C:\Projects\ocr-test\node_modules\@paddle-js-models\ocr\lib\index.js to a dynamic import() which is available in all CommonJS modules.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.