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

Add support for baseUrl overwrite using TS_NODE_BASEURL environment v… #114

Closed
wants to merge 1 commit into from

Conversation

ejhayes
Copy link

@ejhayes ejhayes commented Apr 3, 2020

Adds support for baseUrl overwrite using TS_NODE_BASEURL environment variable.

First off, thanks for this library! It seems that several people are running into a case where they need to change the baseUrl to get this working after running tsc. So far most of the solutions look to be either:

  1. Creating a bootstrap js file for the sole purpose of changing baseUrl
  2. Extending tsconfig.json to extend the orginal tsconfig.json and then set baseUrl based on that

It seems like the simplest solution would be to allow changing the baseUrl via environment variable instead of either of the above options.

@codecov
Copy link

codecov bot commented Apr 3, 2020

Codecov Report

Merging #114 into master will not change coverage by %.
The diff coverage is n/a.

Impacted file tree graph

@@          Coverage Diff           @@
##           master    #114   +/-   ##
======================================
  Coverage    0.00%   0.00%           
======================================
  Files           4       4           
  Lines         129     129           
  Branches       52      52           
======================================
  Misses        129     129           

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 32338c6...9afa8d9. Read the comment docs.

Copy link

@bratanon bratanon left a comment

Choose a reason for hiding this comment

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

Good job, really looking forward for this update.

@cspotcode
Copy link
Collaborator

cspotcode commented May 5, 2021

ts-node allows specifying overrides within your tsconfig.json; it might make sense for tsconfig-paths to detect a ts-node hook and grab the compiler options from there.

{
  "ts-node": {
    "compilerOptions": {
      "baseUrl": "overridden for ts-node"
    }
  },
  "compilerOptions: {
    "baseUrl": "this one is used by tsc"
    // ...
}
// detect ts-node and get options
process[Symbol.for('ts-node.register.instance')].config.options

@jonaskello
Copy link
Member

Seems like some ppl find this useful so I will merge it.

@jonaskello
Copy link
Member

However there seems to be some merge conflicts that needs attending to first.

@information-security
Copy link
Contributor

Hi,

Any updates on this?
This PR is very useful. Without this env var, we are forced to either use any of the workarounds mentioned by the OP or use a third-party package like tscpaths or tsc-alias. This feature is more convenient than these workarounds and keeps our dependency tree less crowded.

I'd appreciate it if you could merge/release this as soon as possible.

@jonaskello
Copy link
Member

If someone could resolve the conflicts a merge would be possible.

@information-security
Copy link
Contributor

@jonaskello
I am willing to contribute but I don't have write access to this repository. Do you want me to submit a new PR?

@jonaskello
Copy link
Member

@information-security Yes, please make a new PR.

@jonaskello
Copy link
Member

Superseded by #185

@jonaskello jonaskello closed this Nov 20, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants