-
-
Notifications
You must be signed in to change notification settings - Fork 6.2k
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
fix(defineOption): only allow string values #6052
Conversation
A breaking change, I thought, the define feat does hava inconsistent behavior, For reference (copy from #5570): From vite's docs
From esbuild's docs
IMO, only allow string values in define option seems not very desirable. |
Yes, this became a breaking change for those who rely on the internal string conversion. Can you point me to the code where esbuild define is used? I tried finding but can't find it. Thanks.
Since there is the internal string conversion, so it might be better to only allow string values to match the docs behavior and avoid the issues like #5150. |
FYI, although only allowing string values will not affect esbuild |
Thanks! I just noticed |
Maybe updating the docs and preventing a breaking change might be a better idea here, mentioning that non-string values are converted to strings using Either way, I'd recommend to submit the fix for |
I second updating the documentation too to prevent a breaking change. And to fix the types for define in the docs. |
Closing it as it could be a breaking change. |
Description
Only allow string values in
define
option as stated in docs. Why made this change is I understanddefine
option's values should be string as per docs. But in the plugin-vue, it is written as boolean and in thedefine
plugin, it converts string if it is not. For a contributor, this is making a subtle difference between the docs and the codebase.Also, TS doesn't give type error for non string values of
define
option. So, I think it is good to unify the internal usage and the docs.Additional context
What is the purpose of this pull request?
Before submitting the PR, please make sure you do the following
fixes #123
).