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

The module "./lib/util/number" was not found on the file system #181

Open
beingj opened this issue Jun 5, 2024 · 1 comment
Open

The module "./lib/util/number" was not found on the file system #181

beingj opened this issue Jun 5, 2024 · 1 comment

Comments

@beingj
Copy link

beingj commented Jun 5, 2024

angular 18 app build error:

✘ [ERROR] Could not resolve "echarts/lib/util/number"

    node_modules/echarts-liquidfill/src/liquidFillView.js:2:28:
      2 │ import * as numberUtil from 'echarts/lib/util/number';
        ╵                             ~~~~~~~~~~~~~~~~~~~~~~~~~

  The module "./lib/util/number" was not found on the file system:

    node_modules/echarts/package.json:215:11:
      215 │     "./*": "./*"
          ╵            ~~~~~

  Import from "echarts/lib/util/number.js" to get the file "node_modules/echarts/lib/util/number.js":

    node_modules/echarts-liquidfill/src/liquidFillView.js:2:52:
      2 │ import * as numberUtil from 'echarts/lib/util/number';
        │                                                     ^
        ╵                                                     .js

  You can mark the path "echarts/lib/util/number" as external to exclude it from the bundle, which will remove this error and leave the unresolved path in the bundle.

root cause: echarts not export lib/util/number in package.json: https://github.com/apache/echarts/blob/master/package.json#L146-L202

if add the lib/util/number to the export section of node_modules/echarts/package.json, the error disappear:

  "exports": {
...
    "./lib/component/visualMapPiecewise": "./lib/component/visualMapPiecewise.js",
    "./lib/util/number": "./lib/util/number.js",  <== add this line
    "./dist/echarts.common": "./dist/echarts.common.js",
...

but modify echart's package.json should not be a good solution. please fix the issue in echarts-liquidfill.

@kingyue737
Copy link

I'm not familiar with angular. What bundler are you using? For vite, you can add the following in config. I believe other bundlers like webpack have similar configs.

    resolve: {
      alias: { 'echarts/lib/util/number': 'echarts/lib/util/number.js' },
    },

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