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

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

Description

@hozuki

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")))

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugIssue identified by VS Code Team member as probable bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions