esbuild-plugin-substrate
raw JSON → 0.3.0 verified Fri May 01 auth: no javascript
An esbuild plugin that converts explorable.md documents into plain JavaScript modules during the build process. Current stable version is 0.3.0. It is a niche plugin targeting literate programming workflows where markdown content is integrated into JavaScript bundles. Compared to general markdown loaders, this plugin specifically handles the explorable.md format and outputs ES modules. It has moderate release cadence with occasional updates.
Common errors
error TypeError: substratePlugin is not a function ↓
cause Importing with named import instead of default import.
fix
Use default import: import substratePlugin from 'esbuild-plugin-substrate'
error Error: Cannot find module 'esbuild-plugin-substrate' ↓
cause Package not installed or Node.js too old (<12.17) to support ESM.
fix
Run npm install esbuild-plugin-substrate and ensure Node.js >=12.17.
Warnings
breaking Package is ESM-only and requires Node >=12.17 and esbuild as a peer dependency. ↓
fix Use import syntax. If using CommonJS, switch to dynamic import() or use a CJS wrapper.
breaking Plugin is specifically designed for esbuild and will not work with other bundlers (Webpack, Rollup, etc.). ↓
fix Use esbuild as the bundler; consider alternative plugins if using another bundler.
Install
npm install esbuild-plugin-substrate yarn add esbuild-plugin-substrate pnpm add esbuild-plugin-substrate Imports
- default wrong
const substratePlugin = require('esbuild-plugin-substrate')correctimport substratePlugin from 'esbuild-plugin-substrate' - substratePlugin (default import) wrong
import { substratePlugin } from 'esbuild-plugin-substrate'correctimport substratePlugin from 'esbuild-plugin-substrate'
Quickstart
// esbuild.js
import esbuild from 'esbuild';
import substratePlugin from 'esbuild-plugin-substrate';
await esbuild.build({
entryPoints: ['input.js'],
bundle: true,
outfile: 'out.js',
plugins: [substratePlugin()]
});