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

v8.6.0 breaks TS_NODE_COMPILER_OPTIONS environment variable #938

Labels

Comments

@dstaley
Copy link

dstaley commented Jan 10, 2020

The release of v8.6.0 introduced the ability to configure via tsconfig.json. However, it looks like in the process the ability to use TS_NODE_COMPILER_OPTIONS was either removed or broken, resulting in broken builds for us.

Since v8.6.0 was a minor semver release and did not have a "Breaking Changes" section in the release notes, I did not anticipate any breaking changes in this release. If the change was intentional, I suggest adding a "Breaking Changes" section to the release notes, otherwise a patch release that restores the behavior would be appreciated! In the meantime I've moved to using tsconfig.json, so this would just be for other users who find themselves in the same situation I found myself in.

@cspotcode
Copy link
Collaborator

cspotcode commented Jan 10, 2020 via email

@dstaley
Copy link
Author

dstaley commented Jan 10, 2020

Sure thing! Here you go.

@blakeembrey
Copy link
Member

Thanks for the report, I think I may have introduced it when refactoring the tsconfig.json support. Revising the logic now.

@cspotcode
Copy link
Collaborator

DEFAULTS.compilerOptions should store the value parsed from the environment variable.
https://github.com/TypeStrong/ts-node/blob/master/src/index.ts#L242

readConfig pulls from DEFAULTS when building the merged compilerOptions object.
https://github.com/TypeStrong/ts-node/blob/master/src/index.ts#L909-L916

Shouldn't that be correctly incorporating the environment variable?

@cspotcode
Copy link
Collaborator

Oh I think it's because of the ordering of overrides.

I put the 2 indicated values out of order. (from here)

config.compilerOptions = Object.assign(
    {},
    DEFAULTS.compilerOptions,  // <-- the env var
    config.compilerOptions, // <-- the tsconfig's "compilerOptions"
    config['ts-node']?.compilerOptions,
    options.compilerOptions,
    TS_NODE_COMPILER_OPTIONS
  )

@blakeembrey
Copy link
Member

Fixed with db409d7 and release as V8.6.1 - thanks!

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