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

Relative transform paths resolved inconsistently with compiler API #59

Closed
nonara opened this issue Aug 22, 2021 · 0 comments
Closed

Relative transform paths resolved inconsistently with compiler API #59

nonara opened this issue Aug 22, 2021 · 0 comments

Comments

@nonara
Copy link
Owner

nonara commented Aug 22, 2021

If the transform path is relative, it is resolved relative to the path housing the project's tsconfig.json.

It seems, however, if the compiler API is used, these paths get resolved relative to cwd. It would be more preferable to determine project root and resolve from there.

Example

/my-project/tsconfig.json

{
  "compilerOptions": {
    "plugins": [
      { "transform": "./my-transformer.ts" }
    ]
  }
}

In the above example:

  • tsc resolves ./my-transformer.ts from /my-project/.
  • ts.createProgram resolves ./my-transformer.ts from process.cwd()

Release Note

I'm choosing to release this update as non-major because it has a very low impact-vector and v2 is marked out for the next version. I wrestled with this for some time, however, because the behaviour is aberrant and likely affects few (if any) people's workflow, I'm marginally comfortable with the decision in this case.

Related

#53

@nonara nonara closed this as completed in e38655a Aug 23, 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

No branches or pull requests

1 participant