Skip to content

Commit

Permalink
fix: (1) fix that some old version bundler (like rollup) do not recog…
Browse files Browse the repository at this point in the history
…nize wildcard that not at the end of the patter string (e.g. "exports: {"./*.js": "xxx"}"). (2) Add readme to package.json.
  • Loading branch information
100pah committed Jan 24, 2024
1 parent 926abff commit 6c7a330
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 4 deletions.
9 changes: 9 additions & 0 deletions package.README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# NOTICE about package.json

Only `zrender.js` are officially exported to users.

The other entries listed in the `"exports"` field of `package.json` make the internal files visible, but they are legacy usages, not recommended but not forbidden (for the sake of keeping backward compatible). These entries are made from the search in github about which internal files are imported.

Since `v5.5.0`, `"type": "module"` and `"exports: {...}"` are added to `package.json`. When upgrading to `v5.5.0+`, if you meet some problems about "can not find/resolve xxx" when importing some internal files, it probably because of the issue "file extension not fully specified". Please try to make the file extension fully specified (that is, `import 'xxx/xxx/xxx.js'` rather than `import 'xxx/xxx/xxx'`), or change the config of you bundler tools to support auto adding file extensions.

See more details about the `"exports"` field of `package.json` and why it is written like that in https://github.com/apache/echarts/pull/19513 .
22 changes: 18 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,23 @@
"require": "./dist/zrender.js",
"import": "./index.js"
},
"./*.js": "./*.js",
"./*.ts": "./*.ts",
"./*.json": "./*.json",
"./*": "./*.js"
"./lib/canvas/canvas": "./lib/canvas/canvas.js",
"./lib/svg/svg": "./lib/svg/svg.js",
"./lib/vml/vml": "./lib/vml/vml.js",
"./lib/canvas/Painter": "./lib/canvas/Painter.js",
"./lib/svg/Painter": "./lib/svg/Painter.js",
"./lib/svg/patch": "./lib/svg/patch.js",
"./lib/Storage": "./lib/Storage.js",
"./lib/core/util": "./lib/core/util.js",
"./lib/core/env": "./lib/core/env.js",
"./lib/core/Transformable": "./lib/core/Transformable.js",
"./lib/core/BoundingRect": "./lib/core/BoundingRect.js",
"./lib/core/vector": "./lib/core/vector.js",
"./lib/core/bbox": "./lib/core/bbox.js",
"./lib/contain/polygon": "./lib/contain/polygon.js",
"./lib/tool/color": "./lib/tool/color.js",
"./lib/graphic/LinearGradient": "./lib/graphic/LinearGradient.js",
"./lib/graphic/RadialGradient": "./lib/graphic/RadialGradient.js",
"./*": "./*"
}
}

0 comments on commit 6c7a330

Please sign in to comment.