Norway Porridge Makers

    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.

    Install

    npm i esbuild-plugin-globcopy

    DownloadsWeekly Downloads

    1

    Version

    0.1.3

    License

    MPL-2.0

    Unpacked Size

    20.8 kB

    Total Files

    4

    Last publish

    Collaborators

    • kettek