Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/pdelacroix/vite-plugin-melange
A Vite plugin for Melange
https://github.com/pdelacroix/vite-plugin-melange
Last synced: 7 days ago
JSON representation
A Vite plugin for Melange
- Host: GitHub
- URL: https://github.com/pdelacroix/vite-plugin-melange
- Owner: pdelacroix
- Created: 2022-03-29T02:05:31.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2024-01-15T00:52:58.000Z (6 months ago)
- Last Synced: 2024-05-02T02:37:10.072Z (about 2 months ago)
- Language: JavaScript
- Size: 51.8 KB
- Stars: 7
- Watchers: 1
- Forks: 2
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Lists
- awesome-reasonml - Vite plugin - A Vite plugin for Melange (Reason / Tools)
README
# vite-plugin-melange
A Vite plugin for Melange.
## Features
- Compile Melange source files as part of the build
- Show errors on the commandline and in the browser overlay
- HMR (hot module replacement) with Melange source filenames as module names## Usage
```bash
npm install --save-dev vite-plugin-melange
````vite.config.js`:
```javascript
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",
}),
]
});
```## Options
- `buildCommand`: *(required)* Dune build command. For instance: `opam exec -- dune build`
- `watchCommand`: *(required)* Dune watch command. For instance: `opam exec -- dune build --watch`
- `buildContext`: *(default: `"default"`)* Dune [build context](https://dune.readthedocs.io/en/stable/overview.html#term-build-context). The default corresponds to Dune's default
- `emitDir`: *(default: `""`)* directory where the `melange.emit` stanza is located. It defaults to empty string, which means the project's root folder, as it's [the recommended location](https://melange.re/v1.0.0/build-system/#guidelines-for-melangeemit)
- `buildTarget`: *(default: `"output"`)* `target` field of the `melange.emit` stanza. It defines [the directory where the JavaScript artifacts will be placed](https://dune.readthedocs.io/en/stable/melange.html#melange-emit)## Build
```bash
npm install
npm run build
```