Skip to content
This repository has been archived by the owner on Apr 19, 2024. It is now read-only.

rewriteLocalizeCalls() doesn't work with 'importHelpers = true' #39

Open
hozuki opened this issue May 20, 2022 · 1 comment
Open

rewriteLocalizeCalls() doesn't work with 'importHelpers = true' #39

hozuki opened this issue May 20, 2022 · 1 comment
Labels
bug Issue identified by VS Code Team member as probable bug

Comments

@hozuki
Copy link

hozuki commented May 20, 2022

When importHelpers is set to true in tsconfig.json, rewriteLocalizeCalls() doesn't generate any bundle files so all localize() invocations go to fallback.

Did a little debug and found out that, the condition here

if (ts.isCallExpression(parent) && ts.isIdentifier(parent.expression) && parent.expression.text === '__importStar') {

is not met.

Possible JS transpiled when using tslib import helpers:

const nls = tslib_1.__importStar(require("vscode-nls"));

Here the expression turns from a global function call to a member access. This case can be handled by (for example):

if (ts.isCallExpression(parent) && ((ts.isIdentifier(parent.expression) && parent.expression.text === '__importStar') || (ts.isPropertyAccessExpression(parent.expression) && parent.expression.name.text === "__importStar")))
@dbaeumer
Copy link
Member

@TylerLeonhardt let me know if you need help with this.

@TylerLeonhardt TylerLeonhardt added the bug Issue identified by VS Code Team member as probable bug label May 25, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Issue identified by VS Code Team member as probable bug
Projects
None yet
Development

No branches or pull requests

3 participants