fix: correctly resolve string literals in export specifiers#386
Conversation
44d8b68 to
18ed4d7
Compare
Swatinem
left a comment
There was a problem hiding this comment.
I’m actually surprised that this works, and doesn’t require the AST node to be a Literal instead.
But okay, I guess this is simpler so why not :-)
|
well, CI says the syntax is not supported. Does it depend on TS6, which I think we haven’t updated to yet, or does it need a specific |
|
Ah, you're right. It requires TS 5.6 for arbitrary module identifiers. I'll add the meta.js file. For the identifier part, I also worried about invalid names, but followed |
18ed4d7 to
ed325ce
Compare
ed325ce to
56fc57a
Compare
|
thanks for the fix. |
Description
Fixes the resolution of ES2022 string literal export names (e.g.,
export { b as "bb" }).Currently, Rollup fails to link identifiers exported as string literals, resulting in missing exports and
[undefined]properties in the bundled output. This occurs becausecreateIdentifierusesnode.getText(), which preserves the surrounding quotes forts.StringLiteralnodes (e.g.,'"bb"'), causing a mismatch in Rollup's linker.Updating this to use
node.textpasses the unquoted identifier value, resolving the issue.Test Case
mod.d.tsindex.d.tsActual Output (Failing):
expected.d.ts