TL;DR: Turn VSCode Webviews into complex React apps with hot reload in development and a secure bundle-based setup in production.

What you’ll build

  • A VS Code extension whose Webview is a React + TypeScript app.
  • HMR (Fast Refresh) in development via Vite.
  • A Content Security Policy (CSP) safe production build.

Table of contents

  1. Scaffold the extension
  2. Create the React app
  3. Fix TS project boundaries
  4. Wire up the Webview panel
  5. Processing the Vite generated HTML
  6. Vite configuration
  7. Run in development
  8. Build & publish
  9. What’s next
  10. Github Implementation

Scaffold the extension

First install yeoman and the VS Code extension generator:

npm install --global yo generator-code
yo...

Similar Posts

Loading similar posts...

Keyboard Shortcuts

Navigation
Next / previous item
j/k
Open post
oorEnter
Preview post
v
Post Actions
Love post
a
Like post
l
Dislike post
d
Undo reaction
u
Recommendations
Add interest / feed
Enter
Not interested
x
Go to
Home
gh
Interests
gi
Feeds
gf
Likes
gl
History
gy
Changelog
gc
Settings
gs
Browse
gb
Search
/
General
Show this help
?
Submit feedback
!
Close modal / unfocus
Esc

Press ? anytime to show this help