2.2.3 • Published 8 months ago

esbuild-plugin-glob v2.2.3

Weekly downloads
-
License
MIT
Repository
-
Last release
8 months ago

This plugin allows the usage of glob patterns as entry points for esbuild. It supports single builds as well as watch mode.

⚠️ Deprecated ⚠️

Esbuild now natively supports glob-style entrypoints since v0.19.0. This plugin is no longer needed.

Also note that this plugin is not yet compatible with esbuild v0.17.0 and up. It's a bit tricky to get it working with the new context api (watch mode in particular). If you'd like this functionality, please open an issue or a PR.

Installation

Use a package manager like yarn or npm

yarn add esbuild-plugin-glob

Usage

import { globPlugin } from 'esbuild-plugin-glob';

esbuild.build({
  entryPoints: ['src/**/*.tsx'],
  // watch: true,
  plugins: [globPlugin()],
});

API and defaults

globPlugin({
  // Optional additional entrypoints/glob patterns
  additionalEntrypoints: [],
  // Options directly passed to chokidar when in watch mode
  chokidarOptions: {},
  // Make the function return a `controls` object, see below
  controls: false,
  // An array of glob patterns to exclude matches
  ignore: []
  // Disables logging on file changes
  silent: false,
})

Controls

By passing the option controls: true the globPlugin function returns a tuple with the plugin object and a controls object.

import { globPlugin } from 'esbuild-plugin-glob';

const [glob, globControls] = globPlugin({ controls: true });

esbuild.build({
  entryPoints: ['src/**/*.tsx'],
  watch: true,
  plugins: [glob],
});

// Stops watching the entry files when in watch mode
await globControls.stopWatching();

How it works

For single builds it simply resolves the provided glob patterns before esbuild runs.

In watch mode it uses chokidar to watch the provided glob patterns and inspects the corresponding esbuild build results to make sure dependencies are also being watched.

Contribute

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

License

MIT

2.2.3

8 months ago

2.2.2

11 months ago

2.2.1

1 year ago

2.1.2

2 years ago

2.2.0

1 year ago

2.1.3

2 years ago

2.1.1

2 years ago

1.1.3

2 years ago

2.1.0

2 years ago

2.0.0

2 years ago

1.1.2

2 years ago

1.1.1

2 years ago

1.1.0

2 years ago

1.0.5

2 years ago

1.0.4

2 years ago

1.0.2

3 years ago

1.0.3

3 years ago

1.0.1

3 years ago

1.0.0

3 years ago

0.2.1

3 years ago

0.2.0

3 years ago

0.1.3

3 years ago

0.1.2

3 years ago

0.1.1

3 years ago