@mml-io/esbuild-plugin-mml
v0.4.0
Published
An MML plugin for esbuild.
Readme
@mml-io/esbuild-plugin-mml
An esbuild plugin that bundles JavaScript/React sources into HTML documents for MML. Supports mml: import prefix for discovering and bundling additional documents.
Installation
npm install --save-dev @mml-io/esbuild-plugin-mmlUsage
import { build } from "esbuild";
import { mml } from "@mml-io/esbuild-plugin-mml";
build({
entryPoints: [
"mml:src/playground/index.tsx", // MML document
"src/playground.ts" // World config
],
outdir: "build",
outbase: "src",
bundle: true,
plugins: [mml()],
});Options
| Option | Type | Description | Default |
|-------------------|-----------|---------------------------------------|-----------|
| verbose | boolean | Enable logging | false |
| pathPrefix | string | Prefix for import path rewrites | ws:/// |
| assetDir | string | Asset output directory | assets |
| assetPrefix | string | Asset URL prefix | / |
| stripHtmlExtension| boolean | Remove .html from output URLs | false |
TypeScript Support
Add these type definitions for custom import syntax:
declare module "*.html" {
const value: string;
export default value;
}
declare module "mml:*" {
const value: string;
export default value;
}