From 71541f85af970bfe78cf397f177d2e23a08a1104 Mon Sep 17 00:00:00 2001 From: 100pah Date: Fri, 14 Jun 2024 02:42:37 +0800 Subject: [PATCH] fix: In users' .d.ts `import('echarts/types/dist/shared')` can not visit `'echarts/types/dist/shared.d.ts'` since v5.5.0. Fix it. Fix #19663. --- package.README.md | 5 ++++- package.json | 8 ++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/package.README.md b/package.README.md index 0b51fbc9bd..0960ecbbd9 100644 --- a/package.README.md +++ b/package.README.md @@ -1,7 +1,8 @@ # NOTICE about package.json -See more details about in the "exports" field of `package.json` and why it is written like that in https://github.com/apache/echarts/pull/19513 . +**[[!Remember!]]**: update the "exports" field of `package.json` if adding new public entry files. +See more details about in the "exports" field of `package.json` and why it is written like that in https://github.com/apache/echarts/pull/19513 . ## Public and private @@ -30,6 +31,8 @@ The other entries listed in the `"exports"` field of `package.json` make the int 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 `echarts/i18n/xxx` or `echarts/theme/xxx` or 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. +About `"./types/dist/shared": "./types/dist/shared.d.ts",` in "exports", see https://github.com/apache/echarts/pull/19663 . + ## Use physical entry file or alias in `"exports"` of `package.json` diff --git a/package.json b/package.json index 3b4dd0fe3f..6b25aab43b 100644 --- a/package.json +++ b/package.json @@ -129,6 +129,14 @@ "./index.js": "./index.js", "./theme/*": "./theme/*", "./i18n/*": "./i18n/*", + "./types/dist/charts": "./types/dist/charts.d.ts", + "./types/dist/components": "./types/dist/components.d.ts", + "./types/dist/core": "./types/dist/core.d.ts", + "./types/dist/echarts": "./types/dist/echarts.d.ts", + "./types/dist/features": "./types/dist/features.d.ts", + "./types/dist/option": "./types/dist/option.d.ts", + "./types/dist/renderers": "./types/dist/renderers.d.ts", + "./types/dist/shared": "./types/dist/shared.d.ts", "./ssr/client/index": { "types": "./ssr/client/index.d.ts", "import": "./ssr/client/index.js",