GitHub - ozanozbek/esbuild-plugin-write-file: esbuild plugin for asynchronously creating/writing files in parallel (original) (raw)

esbuild-plugin-write-file

This esbuild plugin creates/writes files (asynchronously and in parallel) before and after bundling.

Installation

npm install esbuild-plugin-write-file

Usage

import esbuild from 'esbuild'; import writeFilePlugin from 'esbuild-plugin-write-file';

esbuild.build({ // ... plugins: [writeFilePlugin({ before: { // write before bundling './src/template.html': 'template content', './src/license.txt': 'license content' }, after: { // write after bundling './dist/report.json': JSON.stringify({hello: 'world'}) } })] });

Options

before: {String targetPath: String content, ...}

An object with targetPath: content entries. Files are written before bundling.

after: {String targetPath: String content, ...}

An object with targetPath: content entries. Files are written after bundling.