esbuild-plugin-globcopy

0.1.3 • Public • Published

esbuild-plugin-globcopy

An esbuild plugin that adds support for copying files from a source directory to a destination directory using glob.

Its primary use case is to copy files from a static directory to a distribution directory on build.

Installation

npm i -D esbuild-plugin-globcopy

Usage

As with the current esbuild plugin API, this plugin requires a custom build script for usage.

import esbuild from 'esbuild'
import globCopy from 'esbuild-plugin-globcopy'

esbuild.build({
  entryPoints: ['src/index.js'],
  bundle: true,
  outdir: 'dist',
  // ...
  plugins: [
    // ...
    globCopy({
      // srcdir: 'static',
      // targets: ['**.png'],
    })
  ]
})

Options

When calling the module, you can pass in an object that contains various options.

srcdir

This input directory to copy files from. Defaults to ./.

targets

Targets can be an array of strings or a single string that provides glob pattern(s). These are resolved relative to srcdir.

outdir

The output directory to copy files to. Defaults to esbuild's outdir if unspecified.

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 0.1.3
    1
    • latest

Version History

  • Version
    Downloads (Last 7 Days)
    • Published
  • 0.1.3
    1
  • 0.1.2
    1
  • 0.1.0
    1

Package Sidebar

Install

npm i esbuild-plugin-globcopy

Weekly Downloads

3

Version

0.1.3

License

MPL-2.0

Unpacked Size

20.8 kB

Total Files

4

Last publish

Collaborators

  • kettek