Skip to content

pdelacroix/vite-plugin-melange

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

23 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

vite-plugin-melange

A Vite plugin for Melange.

Usage

npm install --save-dev vite-plugin-melange

vite.config.js:

import { defineConfig } from "vite";
import melangePlugin from "vite-plugin-melange";

export default defineConfig({
  plugins: [
    melangePlugin({
      buildCommand: "opam exec -- dune build",
      watchCommand: "opam exec -- dune build --watch",
    }),
  ],
  server: {
    watch: {
      awaitWriteFinish: {
        stabilityThreshold: 500,
        pollInterval: 20,
      },
    },
  },
});

The watch part is configuring chokidar so that the many writes Melange does to its log file appear as a single change (we use the log file to determine when compilation has finished). You may have to tweak it, depending on your project and hardware.

Options

  • buildCommand: (required) Dune build command. For instance: opam exec -- dune build
  • watchCommand: (required) Dune watch command. For instance: opam exec -- dune build --watch

Build

npm install
npm run build

About

A Vite plugin for Melange

Resources

Stars

Watchers

Forks

Packages

No packages published