Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[feature] log error details/context to console #14

Closed
bmcminn opened this issue May 25, 2020 · 5 comments
Closed

[feature] log error details/context to console #14

bmcminn opened this issue May 25, 2020 · 5 comments

Comments

@bmcminn
Copy link

bmcminn commented May 25, 2020

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.

@bmcminn bmcminn changed the title [feature] log error details to console [feature] log error details/context to console May 25, 2020
@evanw
Copy link

evanw commented May 26, 2020

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.

@bmcminn
Copy link
Author

bmcminn commented May 27, 2020

@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.

@egoist
Copy link
Owner

egoist commented Jul 18, 2020

It shows the error detail now but the filename is shown as stdin, maybe allow the transform API to pass in a filename too?

image

@evanw
Copy link

evanw commented Aug 13, 2020

maybe allow the transform API to pass in a filename too?

Just saw this, sorry. This option already exists and is called sourcefile.

@sxzz
Copy link
Collaborator

sxzz commented Sep 20, 2023

Fixed in #118

@sxzz sxzz closed this as completed Sep 20, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants