Stackblitz local dev loop
'Configure local development for WebContainer applications with hot reload and testing.From its SKILL.md
npx -y skills add jeremylongshore/claude-code-plugins-plus-skills --skill stackblitz-local-dev-loopAssembled from the repository path, not quoted from the project. Check it against their README if it does not work.
What its file declares
Copied from the file, not written here
The file declares its own license as MIT. That is the author’s claim about this one file, and it is not the same thing as the license GitHub reports for the repository, which is listed with the other numbers below.
SKILL.md
2.8 KB, 545 tokens by cl100k_base, as published. Nobody here has run it
StackBlitz Local Dev Loop
Overview
Set up a Vite-based development environment for WebContainer applications with cross-origin headers, hot module replacement, and Vitest for testing file system operations.
Instructions
Step 1: Vite Project with WebContainers
npm create vite@latest wc-app -- --template vanilla-ts
cd wc-app
npm install @webcontainer/api
Step 2: Configure Vite Headers
// vite.config.ts
import { defineConfig } from 'vite';
export default defineConfig({
server: {
headers: {
'Cross-Origin-Embedder-Policy': 'require-corp',
'Cross-Origin-Opener-Policy': 'same-origin',
},
},
});
Step 3: Test WebContainer Operations
// 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 Handling
| 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 |
Resources
Next Steps
Proceed to stackblitz-sdk-patterns for production patterns.
What ships with it
Read from the repository
Just SKILL.md. No reference files, no scripts.