Open uns3t opened 2 years ago
Hello. Thank you for contacting.
esbuild-dev-server calling rebuild repeatedly with the same options.
esbuild requires incremental: true
property in options for this.
Read more: https://esbuild.github.io/api/#incremental
Add this property to the options and try again.
const options = {
entryPoints: ['src/app.tsx'],
bundle: true,
metafile: true, // needs to be set
outdir: 'dist/', // needs to be set
incremental: true, // !important
plugins: [
htmlPlugin(htmlPluginOptions),
lessLoader()
],
loader: {
'.ts': 'ts',
},
}
I get the same error, and I made sure to use incremetal: true
esBuildDevServer.start(build({
sourcemap: true,
entryPoints: ['src/index.tsx'],
bundle: true,
outdir: 'build',
platform: 'browser',
minify: true,
keepNames: true,
target: 'es6',
plugins: [
lessLoader(),
],
metafile: true,
incremental: true,
}), {
port: '3000',
watchDir: 'src',
index: 'build/index.html',
staticDir: 'build',
})
Please send the full text of your error. What OS do you use? At what point do you get the error?
I get this error when I try running the server with the options above. I use MacOS 11.6
(node:90358) UnhandledPromiseRejectionWarning: Error: spawn /Users/nikolamusikic/vt/vacationtracker/node_modules/esbuild-dev-server/lib/../../esbuild-dev-server-darwin-x64/devserver EACCES
at Process.ChildProcess._handle.onexit (internal/child_process.js:269:19)
at onErrorNT (internal/child_process.js:467:16)
at processTicksAndRejections (internal/process/task_queues.js:82:21)
(Use `node --trace-warnings ...` to show where the warning was created)
(node:90358) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:90358) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
This happens, because the server binary is not set as executable. Same happens in Linux. Manually making it executable works.
Looking at the makefile and the paths in it, you probably build on Unix-type OS or WSL, so you probably just need a chmod
here and there in the makefile.
Indeed - running chmod u+x node_modules/esbuild-dev-server-darwin-x64/devserver
as a patch till fixed
For Ubuntu you can run
chmod u+x node_modules/esbuild-dev-server-linux-x64/devserver
when i use this plugin, an error occurred
and esbuild code is: