nitro icon indicating copy to clipboard operation
nitro copied to clipboard

feat: extend generated tsconfig `paths` from `aliases`

Open gioboa opened this issue 11 months ago β€’ 6 comments

πŸ”— Linked issue

Fixes: #2476

❓ Type of change

  • [ ] πŸ“– Documentation (updates to the documentation, readme, or JSdoc annotations)
  • [X] 🐞 Bug fix (a non-breaking change that fixes an issue)
  • [ ] πŸ‘Œ Enhancement (improving an existing functionality like performance)
  • [ ] ✨ New feature (a non-breaking change that adds functionality)
  • [ ] 🧹 Chore (updates to the build process or auxiliary tools and libraries)
  • [ ] ⚠️ Breaking change (fix or feature that would cause existing functionality to change)

πŸ“š Description

To manage aliases inside the configuration and create the correct tsconfig file I merged the alias object with the typescript one ( that already works ) To prevent errors we need to check the complex typescript object :sob:
I added typeof checks to prevent errors with wrong configs like eg. alias: 0 or paths: true

export default defineNitroConfig({
  alias: {  πŸ‘ˆ the PR manage this config
    foo: fileURLToPath(new URL("../bar", import.meta.url)),   
  },
  typescript: {
    strict: true,
    tsConfig: {
      files: [],
      compilerOptions: {
        allowJs: true,
        paths: {
          baz: [ fileURLToPath(new URL("../bar", import.meta.url)) ]
        }
      }
    }
  },
});

πŸ“ Checklist

  • [X] I have linked an issue or discussion.
  • [ ] I have updated the documentation accordingly.

gioboa avatar Jan 03 '25 02:01 gioboa

Do I need to do the same change to v3?

gioboa avatar Jan 06 '25 18:01 gioboa

It will be ported to v3 branch. i need to test it little bit to merge for next minor (after patch)

pi0 avatar Jan 06 '25 18:01 pi0

https://github.com/nitrojs/nitro/pull/3056

Thank you, it’s working great! However, the order needed to be adjusted, and the structure had to be improved. You can check out the new PR now.

productdevbook avatar Feb 02 '25 08:02 productdevbook

Do I need to close this one?

gioboa avatar Feb 02 '25 12:02 gioboa

Do I need to close this one?

No, @pi0 will decide after examining it.

productdevbook avatar Feb 02 '25 12:02 productdevbook

@gioboa is attempting to deploy a commit to the Nitro Team on Vercel.

A member of the Team first needs to authorize it.

vercel[bot] avatar Aug 27 '25 08:08 vercel[bot]

[!IMPORTANT]

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

✨ Finishing touches
πŸ§ͺ Generate unit tests (beta)
  • [ ] Create PR with unit tests
  • [ ] Post copyable unit tests in a comment

Comment @coderabbitai help to get the list of available commands and usage tips.

coderabbitai[bot] avatar Dec 01 '25 14:12 coderabbitai[bot]

Open in StackBlitz

npm i https://pkg.pr.new/nitrojs/nitro/nitropack@2964

commit: ca89a08

pkg-pr-new[bot] avatar Dec 01 '25 14:12 pkg-pr-new[bot]