@mml-io/esbuild-plugin-mml
TypeScript icon, indicating that this package has built-in type declarations

0.4.0 • Public • Published

@mml-io/esbuild-plugin-mml

main github actions npm version GitHub top language GitHub license

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-mml

Usage

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;
}

/@mml-io/esbuild-plugin-mml/

    Package Sidebar

    Install

    npm i @mml-io/esbuild-plugin-mml

    Weekly Downloads

    26

    Version

    0.4.0

    License

    MIT

    Unpacked Size

    153 kB

    Total Files

    15

    Last publish

    Collaborators

    • marcuslongmuir
    • deej-io