npm install @wasm-fmt/dart_fmtnpx jsr add @fmt/dart-fmtimport { format } from "@wasm-fmt/dart_fmt";
const source = `void main() { print('Hello, World!'); }`;
const formatted = format(source);
console.log(formatted);dart_fmt does not support ESM Integration entry yet.
Try use other entry points like ./esm or ./web instead.
For web environments, you need to initialize WASM module manually:
import init, { format } from "@wasm-fmt/dart_fmt/web";
await init();
const source = `void main() { print('Hello, World!'); }`;
const formatted = format(source);
console.log(formatted);import init, { format } from "@wasm-fmt/dart_fmt/vite";
await init();
// ....- Auto-detects environment (Node.js uses node, default is ESM)./node- Node.jsmodule-synccompatible, include CommonJS (no init required)./esm- ESM environments like modern Node.js/Deno (no init required)./web- Web browsers (requires manual init)./vite- Vite bundler (requires manual init)
# 1. install Dart https://dart.dev/get-dart
# 2. clone this repo
git clone https://github.com/wasm-fmt/dart_fmt.git
# 3. install dependencies
dart pub get
# 4. build
npm run build
# 5. test
npm run test:node