Skip to content

Commit 3cc87db

Browse files
committed
Allow ignorePaths as a plugin option
Exposes some basic config options to the plugin, for now allowing you to specifically expose a set of paths you wish to ignore from your glob match
1 parent d13aa20 commit 3cc87db

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/index.ts

+6-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,11 @@
11
import fastGlob from 'fast-glob';
22
import { Plugin } from 'esbuild';
33

4-
const EsbuildPluginImportGlob = (): Plugin => ({
4+
interface Config {
5+
ignorePaths: string[];
6+
}
7+
8+
const EsbuildPluginImportGlob = (config?: Config): Plugin => ({
59
name: 'require-context',
610
setup: (build) => {
711
build.onResolve({ filter: /\*/ }, async (args) => {
@@ -22,6 +26,7 @@ const EsbuildPluginImportGlob = (): Plugin => ({
2226
const files = (
2327
await fastGlob(args.path, {
2428
cwd: args.pluginData.resolveDir,
29+
ignore: config?.ignorePaths ?? [],
2530
})
2631
).sort();
2732

0 commit comments

Comments
 (0)