[api-extractor] Cannot assign isExternal=true for the symbol xxx because it was previously registered with isExternal=false
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:

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

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 |
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?
@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
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.