Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pulumi overrides tsconfig.json target #2673

Closed
brandonbloom opened this issue Apr 25, 2019 · 5 comments
Closed

Pulumi overrides tsconfig.json target #2673

brandonbloom opened this issue Apr 25, 2019 · 5 comments
Labels
kind/enhancement Improvements or new features language/javascript resolution/fixed This issue was fixed

Comments

@brandonbloom
Copy link

AWS Lambda supports new-enough node such that we don't need to transpile-away async/await, but Pulumi seems to force tsc to target "es6" (aka "es2015", I think) via ts-node.

For context: I am trying to debug some subtle issue and it was faster to iterate in the Lambda console, but the inversion of control created by the awaiter machinery is a pain to work with. I knew my tsconfig was set to the appropriate target, so I went spelunking and found where Pulumi is not respecting that.

As a component of a potential fix, change this line:

target: "es6",

to target "es2018" and everything seemed to work as expected.

@lukehoban
Copy link
Member

Interesting - I don't recall exactly why we hard coded this one in. It would be nice to ensure that the tsconfig.json settings could be preferred over the defaults provided by Pulumi. I seem to recall this was hard to do with ts-node though.

@ellismg
Copy link
Contributor

ellismg commented Apr 26, 2019

At a minimum, for cases where tsconfig.json is next to package.json (i.e. the CWD we are going to execute in) we could read it and if it sets any fields, don't pass them to ts-node (since it will get them by reading the project, I believe).

@brandonbloom
Copy link
Author

That seems like a good idea. Worth noting that if you're going to read tsconfig.json, you should handle the proper directory search, the extends key's behavior, its extended JSON-with-comments syntax, etc.

I've used https://github.com/TypeStrong/tsconfig for a quick and dirty tool before and it was OK, but has some weird shortcomings like choking on trailing commas where tsc does not. I think they call it jsonc. Might be a good starting point though.

@haohaolee
Copy link

Any update on this?
It feels a little bit annoying that you see complicated transpiled code when you check out the code uploaded in AWS console, it should be elegant since AWS has supported nodejs 12 runtime for a long time

@justinvp
Copy link
Member

Fixed by #7068

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/enhancement Improvements or new features language/javascript resolution/fixed This issue was fixed
Projects
None yet
Development

No branches or pull requests

7 participants