LinbuduLab / esbuild-plugins

ESBuild plugins by @LinbuduLab
MIT License
113 stars 18 forks source link

Fires only when entries changes in watch mode #98

Open luokebi opened 1 year ago

luokebi commented 1 year ago

esbuild version: 0.17.10 use watch mode like this: https://esbuild.github.io/api/#watch

Copy only fires the first time. Not fire when the assets changes

linbudu599 commented 1 year ago

This is a feature should be provided in the 2 major verison but I just forgot that one😢, gonna support that in 2.1.0.

linbudu599 commented 1 year ago

It seems that ESBuild will re-execute all plugin when files under absWorkingDir changed in watching mode, so copy-on-change should only works for the files outside absWorkingDir, uh-huh but it's still useful in some cases.

linbudu599 commented 1 year ago

The copy-on-watch feature was supported in 2.1.0 now, I've checked in several cases but there might be missing ones, if you got any troubles, please report in this issue and I'd keep it open for a long time.

countzero commented 1 year ago

@linbudu599 I am not sure, if this is related. I am using the following configuration

esbuild version: 0.17.14 esbuild-plugin-copy version: 2.1.1 use watch mode like this: https://esbuild.github.io/api/#watch

But the plugin does not start watching correctly. The info message is:

Watching mode disabled. You need to enable build.watch option for watch mode to work.

Should this not be supported as of 2.1.0?

BlueGreenMagick commented 1 year ago

The plugin is copying all resource files each time rebuild is triggered due to watch. build.onStart and build.onEnd is triggered on each rebuild. I think the asset copying should be done in setup(build) instead.

I am also unable to setbuild.watch option because esbuild disallows unknown flags on build options.

esbuild version: 0.17.17 esbuild-plugin-copy version: 2.1.1

muffinresearch commented 1 year ago

See also https://github.com/evanw/esbuild/issues/2823