Installation
Morphic Blocks lists Blockly as a dependency, so it is installed for you:
npm install morphic-blocksbun add morphic-blockspnpm add morphic-blocksBlockly’s media
Section titled “Blockly’s media”Blockly’s images and sounds load from blockly-media/ next to your page. The
bundler plugin that comes with the package copies them there when dev or
build starts:
// vite.config.ts (also morphic-blocks/webpack, /rspack, /rollup, /esbuild)import blocklyMedia from "morphic-blocks/vite";
export default { plugins: [blocklyMedia()] };With Parcel, Turbopack or no bundler, run morphic-blocks copy-media public/blockly-media before dev and build instead. See
Privacy & External Requests for other folders and servers.
Optional: code editor packages
Section titled “Optional: code editor packages”The code editor and the codespaces are built on CodeMirror 6. The CodeMirror packages are optional peer dependencies — install them only if you use those views:
npm install @codemirror/state @codemirror/view @codemirror/lang-javascriptbun add @codemirror/state @codemirror/view @codemirror/lang-javascriptpnpm add @codemirror/state @codemirror/view @codemirror/lang-javascriptThey are loaded lazily: a project that never mounts a code editor never pays for them.
@codemirror/lang-javascript is needed only for the code editor, which shows
the JavaScript generated from the blocks, useful for testing and debugging.
Codespaces show your own languages and work without it.
Requirements
Section titled “Requirements”- A bundler-based setup (Vite, or anything that resolves modern ESM). The library ships ES modules plus TypeScript declarations.
- TypeScript is recommended — the public API is fully typed — but not required.
Next: the Quick Start.