Skip to content

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

@beingj

Description

@beingj

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions