fix: passing BindingResolveOptions#alias from js to rust with maintaining order#798
Conversation
✅ Deploy Preview for rolldown-rs canceled.
|
CodSpeed Performance ReportMerging #798 will not alter performanceComparing Summary
|
| #[serde(rename_all = "camelCase")] | ||
| pub struct AliasItem { | ||
| pub find: String, | ||
| pub replacement: Vec<String>, |
There was a problem hiding this comment.
| pub replacement: Vec<String>, | |
| pub replacements: Vec<String>, |
|
|
||
| export type RolldownResolveOptions = Omit<BindingResolveOptions, 'alias'> & { | ||
| alias?: Record<string, string> | ||
| alias?: Record<string, string> | Alias[] |
There was a problem hiding this comment.
Please don't change the type of alias. For users, they still pass alias using object.
There was a problem hiding this comment.
But I notice that, in vite and rollup, config alias is support for Array and object
There was a problem hiding this comment.
Yeah. Vite use https://github.com/rollup/plugins/tree/master/packages/alias#entries under the hood. The API it provided has different usages for array or object, which means you could not use object to use customResolver API.
However, we don't have this need. In our cases, object and array does the same thing. To keep it simple, supporting object only would be fine.
BindingResolveOptions#alias from js to rust with maintaining order
78d84cd to
d27f635
Compare
Description
convert
aliastoVec<AliasItem>for issue #790