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

"banner" must be a string #4026

Open
HomyeeKing opened this issue Jan 3, 2025 · 5 comments
Open

"banner" must be a string #4026

HomyeeKing opened this issue Jan 3, 2025 · 5 comments

Comments

@HomyeeKing
Copy link

here's the reproduce link

in transform mode, will get the error
image

but the build mode is fine
image

@evanw
Copy link
Owner

evanw commented Jan 3, 2025

You’re getting an error that says “banner must be a string” in transform mode because “banner” must be a string in transform mode. The error message is correct. You need you fix your code to address the error message.

@HomyeeKing
Copy link
Author

HomyeeKing commented Jan 3, 2025

OK. I think maybe the docs here should show the difference or it might cause confuse

and also no idea what's the proper string format, is it like "js=//comment"?

@HomyeeKing
Copy link
Author

And I wonder if esbuild can handle the format internally? It's very unconvinient both write a string here and the one config in two format

@hyrious
Copy link

hyrious commented Jan 3, 2025

The format is infered by --loader=js|css from options.

@evanw
Copy link
Owner

evanw commented Jan 3, 2025

And I wonder if esbuild can handle the format internally? It's very unconvinient both write a string here and the one config in two format

The rationale is that the build API can handle multiple files while the transform API only ever handles a single string. Specifying both banner types to the transform API is arguably confusing because that involves specifying something that cannot possibly affect the output. So instead the transform API only takes a single string, which is the string that the API uses. I agree that the documentation should provide examples for both APIs.

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

3 participants