microsoft / microsoft/fluentui
[Bug]: workspace-plugin `generate-api` silently skips every export-subpath rollup on Windows
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 20.3k
- Forks
- 2.9k
- Avg merge
- 2d 9h
- Merged PRs (30d)
- 46
Description
Area
workspace-plugin (package)
Environment
OS: Windows 11
node v22.12.0
@fluentui/workspace-plugin (in-repo tools/workspace-plugin)
Current Behavior
tools/workspace-plugin/src/executors/generate-api/lib/utils.ts, in getExportSubpathConfigs:
const resolvedPrimaryEntry = resolve(
configDir,
primaryMainEntryTemplate.replace(/<unscopedPackageName>/g, unscopedPackageName),
);
const indexDtsSuffix = '/index.d.ts';
if (!resolvedPrimaryEntry.endsWith(indexDtsSuffix)) {
// …skip
}
path.resolve emits backslash-separated paths on Windows, so resolvedPrimaryEntry never ends
with the hard-coded posix suffix '/index.d.ts'. The guard therefore fires for every project and
every export-subpath API rollup is skipped, silently, on Windows machines. Linux CI is
unaffected, which is why the behaviour has not surfaced there.
Concretely: on a Windows checkout, generate-api for
@fluentui/react-headless-components-preview emits 0 subpath rollups where it should emit 56.
A contributor on Windows therefore cannot regenerate the etc/*.api.md files their change requires,
and — worse — a run that produces nothing looks the same as a run that had nothing to produce.
Expected Behavior
Subpath rollups are generated on every supported development platform, and a path that cannot be
matched raises rather than silently skipping.
Reproduction
On Windows, run generate-api for any package that declares export subpaths (e.g.
@fluentui/react-headless-components-preview) and compare the emitted rollups against a Linux run.
Steps to reproduce
- On a Windows checkout, run the
generate-apiexecutor for a package withexportssubpaths. - Observe that no per-subpath
.d.tsrollup oretc/*.api.mdis produced. - Instrument
resolvedPrimaryEntry— it is backslash-separated and fails the'/index.d.ts'check.
Discovery context
Found while scaffolding a new package with a large export-subpath surface on a Windows checkout,
during work on a styling layer over @fluentui/react-headless-components-preview. The package's
API reports came back empty, and tracing that led here. Nothing about the finding is specific to
that work: any Windows contributor touching a package with subpath exports hits it.
Proposed fix
Normalize to posix separators before the suffix check:
const resolvedPrimaryEntry = resolve(
configDir,
primaryMainEntryTemplate.replace(/<unscopedPackageName>/g, unscopedPackageName),
).replace(/\\/g, '/');
One expression, with a comment recording why (so it survives a future tidy). 56 headless rollups
emit locally after the change; CI output is unchanged, since it was already correct there.
A working implementation is included in PR #[WINDMOD-PR-NUMBER] (part of commit d826380ae5);
happy to split it into a standalone PR against this issue — it is independent of everything else in
that PR.
Suggested severity
Medium - Has workaround (regenerate API reports on Linux/WSL or let CI do it).
Products/sites affected
Local development on Windows for any package with export subpaths.
Are you willing to submit a PR to fix?
yes
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in tools/workspace-plugin/src/executors/generate-api/lib/utils.ts at getExportSubpathConfigs and reproduce the Windows run for a package with export subpaths. Verify the path handling around the index.d.ts suffix check, then run generate-api and confirm that the expected per-subpath rollups and etc/*.api.md files are produced, including the 56 headless rollups described here.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- build-system
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Active
- Clarity
- Clearly specified
- Newbie friendliness
- 85/100