esbuild-plugin-import-glob icon indicating copy to clipboard operation
esbuild-plugin-import-glob copied to clipboard

Wrong behavior when the same glob string is used in different directories

Open MartinKolbAtWork opened this issue 3 years ago • 0 comments

I have a scenario where a glob string (e.g. ./processor/**/*) is used in multiple places in files that are in different directories. In these directories, the resolution of the globbing must result in different files. However, during processing, the globbing is done only once, and when the same glob string appears in a another file, then the same files are used again.

I provided an example in this Github repository: https://github.com/MartinKolbAtWork/esbuild-plugin-import-glob-issue

The files in ProcessorManagerA.js and ProcessorManagerB.js both use the same glob string ./processor/**/* The esbuild process can be started using npm run build. The globbing from ProcessorManagerA.js should result in using the files Processor1 and Processor2. The globbing from ProcessorManagerB.js should result in using the files Processor3, Processor4, and Processor5.

However, when looking into the output file out.js, it can be seen that only Processor1 and Processor2 were found and processed.

A pull-request that proposes a possible solution can be found here: https://github.com/thomaschaaf/esbuild-plugin-import-glob/pull/10

MartinKolbAtWork avatar Feb 09 '22 17:02 MartinKolbAtWork