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

[api-extractor] Cannot assign isExternal=true for the symbol xxx because it was previously registered with isExternal=false #3614

Open
wjgogogo opened this issue Sep 5, 2022 · 3 comments

Comments

@wjgogogo
Copy link

wjgogogo commented Sep 5, 2022

we have a monorepo project called s2, and includes four libs:

  • s2-core
  • s2-shared
  • s2-react
  • s2-vue

and add s2-shared into bundledPackages:
image

s2-react is all good, excludes all s2-core types, and includes s2-shared types:
image
but s2-vue includes both s2-core and s2-shared types:
image
moreover, if I change import order in s2-vue, it shows some error:
image

Summary

Repro steps

Expected result:

Actual result:

Details

Standard questions

Please answer these questions to help us investigate your issue more quickly:

Question Answer
@microsoft/api-extractor version? ^7.24.2
Operating system? macOS
API Extractor scenario? rollups
Would you consider contributing a PR?
TypeScript compiler version? 4.7.2
Node.js version (node -v)? 16.14.2
@zelliott
Copy link
Contributor

zelliott commented Sep 5, 2022

Haven't taking a super close look yet - but I noticed your s2-react package has some path mappings that your s2-vue package doesn't have. If you use those same path mappings in your s2-vue package, does this fix your issue?

@wjgogogo wjgogogo changed the title [api-extractor] Cannot assign isExternal=true for the symbol BaseTooltip because it was previously registered with isExternal=false [api-extractor] Cannot assign isExternal=true for the symbol xxx because it was previously registered with isExternal=false Sep 5, 2022
@wjgogogo
Copy link
Author

wjgogogo commented Sep 5, 2022

@zelliott thanks for your timly reply, but not exactly, s2-vue extends tsconfig.base.json, both of s2-react and s2-vue have the path mapping

@zelliott
Copy link
Contributor

zelliott commented Sep 9, 2022

That makes sense. I had a bit more time to look into this today and think I've found the problem - a discrepancy in the generated .d.ts files. However, I don't know what the root cause of the discrepancy is yet. Maybe you can investigate further on your side?

API Extractor runs on .d.ts files, as you probably know. If you open a .d.ts file like pivot-sheet.vue.d.ts, you'll notice a bunch of import("@antv/s2") statements. However, if you open a .d.ts file like table-sheet.vue.d.ts, you'll instead notice a bunch of import("s2-core/esm") statements. I believe it is these latter statements that are causing API Extractor to include s2-core typings in your .d.ts rollup.

When I debug API Extractor, it treats the @antv/s2 module specifier as "external" to s2-vue (expected behavior), while it treats the s2-core module specifier as "internal" to s2-vue. I'm not sure if this is unexpected behavior on API Extractor's part, I'll need to debug further. But I'm somewhat confident that if you're able to fix your TS compiler settings to always write @antv/s2 instead of s2-core/esm, then your problem will be resolved.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: AE/AD
Development

No branches or pull requests

2 participants