From stackblitz-pack
Sets up Vite dev server for WebContainer apps with COOP/COEP headers, hot reload, and Vitest for testing file operations.
How this skill is triggered — by the user, by Claude, or both
Slash command
/stackblitz-pack:stackblitz-local-dev-loopThis skill is limited to the following tools:
The summary Claude sees in its skill listing — used to decide when to auto-load this skill
Set up a Vite-based development environment for WebContainer applications with cross-origin headers, hot module replacement, and Vitest for testing file system operations.
Set up a Vite-based development environment for WebContainer applications with cross-origin headers, hot module replacement, and Vitest for testing file system operations.
npm create vite@latest wc-app -- --template vanilla-ts
cd wc-app
npm install @webcontainer/api
// vite.config.ts
import { defineConfig } from 'vite';
export default defineConfig({
server: {
headers: {
'Cross-Origin-Embedder-Policy': 'require-corp',
'Cross-Origin-Opener-Policy': 'same-origin',
},
},
});
// tests/webcontainer.test.ts
import { describe, it, expect } from 'vitest';
// Note: WebContainer tests require a browser environment
// Use Playwright for full integration tests
describe('FileSystemTree Builder', () => {
it('creates valid tree from flat paths', () => {
const tree = buildFileTree({
'src/index.ts': 'console.log("hello")',
'package.json': '{"name":"test"}',
});
expect(tree['package.json']).toHaveProperty('file');
expect(tree.src).toHaveProperty('directory');
});
});
function buildFileTree(flatFiles: Record<string, string>) {
const tree: any = {};
for (const [path, contents] of Object.entries(flatFiles)) {
const parts = path.split('/');
let current = tree;
for (let i = 0; i < parts.length - 1; i++) {
if (!current[parts[i]]) current[parts[i]] = { directory: {} };
current = current[parts[i]].directory;
}
current[parts[parts.length - 1]] = { file: { contents } };
}
return tree;
}
| Error | Cause | Solution |
|---|---|---|
| COOP/COEP errors | Missing headers | Add to vite.config.ts |
SharedArrayBuffer undefined | Not cross-origin isolated | Check response headers |
| Test failures | WebContainer needs browser | Use Playwright for integration |
Proceed to stackblitz-sdk-patterns for production patterns.
npx claudepluginhub jeremylongshore/claude-code-plugins-plus-skills --plugin stackblitz-packBoots WebContainer to mount files, install npm packages, and run Node.js dev servers in-browser. For WebContainers demos, browser IDEs, or serverless Node execution.
Sets up Vercel local dev server with vercel dev, pulls env vars, enables hot reload, and tests serverless functions/APIs. For fast local iteration on Vercel projects.
Vite build tool patterns: config, plugins, HMR, env variables, proxy, SSR, library mode, dependency pre-bundling, and build optimization for Vite-based projects.