rollup-plugin-esbuild
rollup-plugin-esbuild copied to clipboard
[feature] log error details/context to console
Currently utilizing this plugin in my Vue app build process and I keep getting very vague error indications making this process virtually useless...
bundles client/main.js → public\assets\bundle.js...
[!] (plugin esbuild) Error: Transform failed with 1 error
client\store\auth.js
Error: Transform failed with 1 error
at failureErrorWithLog (C:\github\my-watch-list\node_modules\esbuild\lib\main.js:62:17)
at Object.transform (C:\github\my-watch-list\node_modules\esbuild\lib\main.js:279:38)
at processTicksAndRejections (internal/process/task_queues.js:86:5)
I'm doing some more research into ESBuild in general, however it's unacceptable that this tool should warn me of errors and give me zero context for where the error was actually found...
The documentation doesn't mention anything about a verbose mode either.
This is unfortunate. I didn't include the errors here because esbuild can potentially generate hundreds of errors and I didn't want the exception string to ever be huge. The errors are in an array in the errors property on the exception. But I can definitely include the first few errors in the exception message. I'm sure this library isn't the only one with this problem. This will be in the new 0.4.0 release that will be coming sometime soon.
@evanw Glad to hear it :)
I got around this issue by making esbuild an optional step for production only in my rolloup.config.js file. Kinda defeats the purpose of using ESBuild in the first place, but this is a decent stopgap in the meantime.
// ...
const production = !process.env.ROLLUP_WATCH
export default {
// ...
plugins: [
// ...
production && esbuild({
minify: production,
// target: 'es2015'
}),
// ...
],
}
It would be awesome if it were possible to configure how many errors I would want to see in the console, so it could default to -1 or 1, but a user could override it with whatever number made sense for their purposes.
It shows the error detail now but the filename is shown as stdin, maybe allow the transform API to pass in a filename too?

maybe allow the
transformAPI to pass in a filename too?
Just saw this, sorry. This option already exists and is called sourcefile.
Fixed in #118