Skip to content

Commit

Permalink
fix(es5): workaround around es5 helpers name conflict (#2013)
Browse files Browse the repository at this point in the history
fixes #1916
  • Loading branch information
manucorporat committed Nov 15, 2019
1 parent 5669c28 commit b5353bd
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/compiler/transpile/transpile-to-es5-worker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,14 @@ export async function transpileToEs5Worker(_cwd: string, input: string, inlineHe
);

if (results.diagnostics.length === 0) {
results.code = tsResults.outputText;
results.code = fixHelpers(tsResults.outputText);
}

return results;
}

// TODO:
// remove once fixed: https://github.com/microsoft/TypeScript/issues/35108
function fixHelpers(code: string) {
return code.replace(/\b__(extends|assign|rest|decorate|param|metadata|awaiter|generator|exportStar|values|read|spread|spreadArrays|await|asyncGenerator|asyncDelegator|asyncValues|makeTemplateObject|importStar|importDefault|)_\d\(/g, '__$1(');
}

2 comments on commit b5353bd

@jainanuj0812
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This fix still not working, I can see loader.mjs has the the variables defined multiple times. (may be impacted by other libraries that we are using). And this leads to '#1842'

Can you please provide me any other workaround?

@jainanuj0812
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was testing it with 1.8.3

Tested with latest and it is working fine. (may be typescript fixed it in 3.8.3) :P

Please sign in to comment.