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

Support for the new "${configDir}" template variable coming in TS v5.5.0 #3782

Closed
fabiospampinato opened this issue May 26, 2024 · 2 comments
Labels

Comments

@fabiospampinato
Copy link

In TS v5.5.0 a new ${configDir} template variables will be supported.

Trying to bundle a project that uses that variables in its tsconfig.json with the following command with [email protected]:

esbuild --bundle --minify --format=esm --platform=node src/bin.ts > dist/bin.js  

Results in the following warnings:

▲ [WARNING] Non-relative path "${configDir}/src" is not allowed when "baseUrl" is not set (did you forget a leading "./"?) [tsconfig.json]

    node_modules/tsex/tsconfig.json:47:12:
      47 │       "~": ["${configDir}/src"],
         ╵             ~~~~~~~~~~~~~~~~~~

▲ [WARNING] Non-relative path "${configDir}/src/*" is not allowed when "baseUrl" is not set (did you forget a leading "./"?) [tsconfig.json]

    node_modules/tsex/tsconfig.json:48:14:
      48 │       "~/*": ["${configDir}/src/*"]
         ╵               ~~~~~~~~~~~~~~~~~~~~

2 warnings
@evanw evanw added the tsconfig label May 26, 2024
@evanw
Copy link
Owner

evanw commented Jun 8, 2024

Just looked into microsoft/TypeScript#58042 a bit. It looks like as far as esbuild is concerned, this only affects baseUrl and paths. If the string starts with "${configDir}" (only at the start, not anywhere else), I need to replace that prefix with "./" and then resolve that into an absolute path relative to the directory containing the root-level tsconfig.json file. In particular, it looks like you don't need to use a slash after ${configDir} since "${configDir}/lib" becomes ".//lib" after this substitution. Hopefully I'm understanding everything correctly.

@evanw evanw closed this as completed in 98cb2ed Jun 8, 2024
@fabiospampinato
Copy link
Author

Yeah if there's something that should be done differently in your implementation I don't know what it is. Thanks 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants