chore(vscode-ext-webview): add sideEffects flag and clarify optional peers#786
Closed
tnaum-ms wants to merge 4 commits into
Closed
chore(vscode-ext-webview): add sideEffects flag and clarify optional peers#786tnaum-ms wants to merge 4 commits into
tnaum-ms wants to merge 4 commits into
Conversation
Reconcile the install prose and peer-dependency table with the actual peerDependenciesMeta: list all four peers and mark react and vscode-webview as optional, so host-only / non-React consumers know they are not required. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Contributor
There was a problem hiding this comment.
Pull request overview
Publish-readiness tweaks for the @microsoft/vscode-ext-webview workspace package, focused on improving consumer bundling behavior and clarifying install-time expectations for peer dependencies.
Changes:
- Declare
"sideEffects": falseinpackages/vscode-ext-webview/package.jsonto enable more effective tree-shaking in consumer bundlers. - Update
packages/vscode-ext-webview/README.mdto explicitly document which peer dependencies are optional and why. - Add an internal PR note under
docs/ai-and-plans/PRs/786-webview-api-tweak/capturing rationale and verification steps.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| packages/vscode-ext-webview/package.json | Adds "sideEffects": false to support consumer tree-shaking. |
| packages/vscode-ext-webview/README.md | Clarifies peer dependency requirements/optionality and updates the peer table. |
| docs/ai-and-plans/PRs/786-webview-api-tweak/webview-api-tweak-notes.md | Internal notes documenting rationale and verification for the tweaks. |
Address Copilot review feedback: the install prose implied a framework-agnostic ./webview consumer needs vscode-webview, which contradicted the peer-dependency table. Only src/react/WebviewContext.tsx imports vscode-webview; the ./webview transport uses its own structural VsCodeApiLike. Reword the prose and table row to scope both optional peers to the ./react surface, and record the review round in the notes. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Contributor
✅ Code Quality Checks
This comment is updated automatically on each push. |
Contributor
📦 Build Size Report
Download artifact · updated automatically on each push. |
Collaborator
Author
|
Closing in favor of #787, which supersedes this PR — it includes both changes here plus an additional |
auto-merge was automatically disabled
July 7, 2026 09:26
Pull request was closed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Two small, publish-readiness tweaks to the
@microsoft/vscode-ext-webviewpackage, following review feedback on the webview API migration (PR #766).1.
"sideEffects": falseinpackage.jsonThe package is fully side-effect free (verified by scanning every non-test source file — only pure declarations, a
WeakMapallocation, and a pureinitTRPC().create()builder). Declaring"sideEffects": falselets consumers' bundlers (webpack / Rollup / esbuild / Vite) safely drop unused exports, giving cleaner tree-shaking. Combined with the existing subpath exports (.,./host,./webview,./react), a consumer only pays for what they import.engineswas intentionally not added — it's optional for a bundler-consumed library and risks spuriousEBADENGINEwarnings.2. Doc clarification: optional peer dependencies
reactandvscode-webvieware already declared optional viapeerDependenciesMeta, but the README install prose omittedvscode-webviewand didn't call out which peers are optional. Reconciled the prose and the peer-dependency table so host-only / non-React consumers know those peers aren't required.Verification
npm run build(tsc) — ✅ cleannpx prettier --check— ✅ cleannpm test(jest) — ✅ 89/89 tests, 11 suitesNotes
No code/runtime behaviour changes — metadata + docs only.