playground/browser-extension-js/README.md
A Chrome extension demo using @clerk/chrome-extension with plain TypeScript. No Chrome extension frameworks (no WXT, Plasmo, CRXJS, etc.). Uses bun build to bundle the TypeScript source.
src/
popup.ts # TypeScript source (bundled to build/popup.js)
build/
manifest.json # Chrome extension manifest (Manifest V3)
popup.html # Popup page
popup.css # Popup styles
popup.js # Bundled output (gitignored)
.env.example # Environment variable template
.env # Your publishable key (gitignored)
Static extension files (manifest.json, popup.html, popup.css) live directly in build/ and are checked into git. bun build automatically loads .env, replaces process.env.CLERK_PUBLISHABLE_KEY at build time, and bundles src/popup.ts into build/popup.js.
@clerk/chrome-extension and its dependenciesFrom the repository root:
pnpm turbo build --filter=@clerk/chrome-extension...
From the repository root, start the local registry and publish @clerk/chrome-extension (along with its workspace dependencies):
pnpm pkglab up
pnpm pkglab pub @clerk/chrome-extension
cd playground/browser-extension-js
To see which packages have been published:
pnpm pkglab:ls
From this playground directory (playground/browser-extension-js):
pnpm pkglab:add
This playground is not a pnpm workspace member, so use pnpm install to install dependencies:
pnpm install --ignore-workspace
The first time you install packages you will will may to approve builds. Use:
pnpm approve-builds --ignore-workspace
Copy .env.example to .env and add your Clerk publishable key:
cp .env.example .env
Then edit .env:
CLERK_PUBLISHABLE_KEY=pk_test_...
pnpm build
chrome://extensions/build/ directory inside this playgroundTo rebuild on file changes:
pnpm dev
When you make changes to @clerk/chrome-extension (or its dependencies), rebuild and republish to pkglab:
# From repo root
pnpm turbo build --filter=@clerk/chrome-extension... && pnpm pkglab pub @clerk/chrome-extension
# From this playground
# If you haven't approved build yet
pnpm install --ignore-workspace
pnpm approve-builds
pnpm dev
# If you have approved builds already
pnpm install
pnpm dev