Invalid option in build() call: "watch"
Full error message
I am following the example as it is described here:
https://bilalbudhani.com/chokidar-esbuild/
When I do:
node esbuild.config.js --watch
I get the message:
[ERROR] Invalid option in build() call: "watch"
I have no idea why this is happening.
Is "watch" not longer a parameter?
I also did this example:
const path = require('path')
require("esbuild").build({
entryPoints: ["application.js", "client.js"],
bundle: true,
sourcemap: true,
outdir: path.join(process.cwd(), "app/assets/builds"),
absWorkingDir: path.join(process.cwd(), "app/javascript"),
minify: true,
watch: true,
})
.then(() => console.log("⚡Done"))
.catch(() => process.exit(1));
If i remove the line "watch:true", it compiles ok. But if I leave it, I get the same error:
Invalid option in build() call: "watch"
when I do: node esbuild.config.jsSolutionsource: stackoverflow \u2197
Summing up from the comments: esbuild <v0.16 has removed the watch option. Most tutorials and HowTos are pointing to that version. Downgrade your esbuild to that if you want to use it like described there. Better option is to use esbuild >0.16 which has a built in live reload which combines watch and serve using the newly introduced context
API access
Get this solution programmatically \u2014 free, no authentication.
curl https://depscope.dev/api/error/c22cbdc2bd2fccfa42ebe4eabccf3ebe7fd729e47896f5d763f900a2119b2a7dhash \u00b7 c22cbdc2bd2fccfa42ebe4eabccf3ebe7fd729e47896f5d763f900a2119b2a7d