LinbuduLab / esbuild-plugins

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

Support watch mode when running esbuild via js #112

Open oddnugget opened 1 month ago

oddnugget commented 1 month ago

Currently, watch: true on this plugin states that it needs build({wach: true}) however watch: true is not an option when using the js api. instead one must do:

  esbuild
    .context(opts)
    .then((ctx) => {
      ctx.watch();
    })

however when doing it this way the plugin complains that watch is not true

jerrychan7 commented 2 days ago

This is an incompatibility caused by esbuild version upgrade (>= 0.17). If the context API is used, the watch mode will be difficult to identify, and a new identification logic that does not rely on build.initialOptions.watch is required. See also https://github.com/evanw/esbuild/issues/2823