Skip to content

Update Documentation: tsconfig.json Aliases#6006

Merged
TheOtterlord merged 4 commits into
withastro:mainfrom
yt-kevincarrera:patch-2
Dec 31, 2023
Merged

Update Documentation: tsconfig.json Aliases#6006
TheOtterlord merged 4 commits into
withastro:mainfrom
yt-kevincarrera:patch-2

Conversation

@yt-kevincarrera
Copy link
Copy Markdown
Contributor

Description

Clarify in the documentation that tsconfig.json aliases are not supported in the astro.config.ts file. Suggest using relative paths for module imports in this file instead of tsconfig.json aliases.

Related issues

"Clarify in the documentation that tsconfig.json aliases are not supported in the astro.config.ts file. Suggest using relative paths for module imports in this file instead of tsconfig.json aliases."
@vercel
Copy link
Copy Markdown

vercel Bot commented Dec 30, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
docs ✅ Ready (Inspect) Visit Preview Dec 31, 2023 4:21pm
1 Ignored Deployment
Name Status Preview Comments Updated (UTC)
docs-i18n ⬜️ Ignored (Inspect) Visit Preview Dec 31, 2023 4:21pm

@sarah11918
Copy link
Copy Markdown
Member

Thanks for hopping on this one! @VoxelMC , can I ask you to review? 🙌

Copy link
Copy Markdown
Member

@TheOtterlord TheOtterlord left a comment

Choose a reason for hiding this comment

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

Thanks for the PR @gsi-kevincarrera!

I have a quick text suggestion, to make the text more direct/clear, and provide a helpful link the the tsconfig paths docs.


:::note
Vite-specific `import.meta` properties, like `import.meta.env` or `import.meta.glob`, are _not_ accessible from your configuration file. We recommend alternatives like [dotenv](https://github.com/motdotla/dotenv) or [fast-glob](https://github.com/mrmlnc/fast-glob) for these respective use cases.
Vite-specific `import.meta` properties, like `import.meta.env` or `import.meta.glob`, are _not_ accessible from your configuration file. We recommend alternatives like [dotenv](https://github.com/motdotla/dotenv) or [fast-glob](https://github.com/mrmlnc/fast-glob) for these respective use cases. Please note, that tsconfig aliases are not supported. For module imports in this file, we recommend using relative paths.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Suggested change
Vite-specific `import.meta` properties, like `import.meta.env` or `import.meta.glob`, are _not_ accessible from your configuration file. We recommend alternatives like [dotenv](https://github.com/motdotla/dotenv) or [fast-glob](https://github.com/mrmlnc/fast-glob) for these respective use cases. Please note, that tsconfig aliases are not supported. For module imports in this file, we recommend using relative paths.
Vite-specific `import.meta` properties, like `import.meta.env` or `import.meta.glob`, are _not_ accessible from your configuration file. We recommend alternatives like [dotenv](https://github.com/motdotla/dotenv) or [fast-glob](https://github.com/mrmlnc/fast-glob) for these respective use cases. In addition, [tsconfig path aliases](https://www.typescriptlang.org/tsconfig#paths) will not be resolved. Use relative paths for module imports in this file.

Copy link
Copy Markdown
Contributor Author

@yt-kevincarrera yt-kevincarrera left a comment

Choose a reason for hiding this comment

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

Done!! Thanks for the help

@sarah11918 sarah11918 added the add new content Document something that is not in docs. May require testing, confirmation, or affect other pages. label Dec 31, 2023
@sarah11918 sarah11918 added the Merge Queue Approved and ready to be merged (wait for feature release if also labelled M-O-R)! label Dec 31, 2023
@TheOtterlord TheOtterlord merged commit 2eec07c into withastro:main Dec 31, 2023
@VoxelMC
Copy link
Copy Markdown
Contributor

VoxelMC commented Dec 31, 2023

Thanks for hopping on this one! @VoxelMC , can I ask you to review? 🙌

I just missed it; sorry about that! I'll be on the next ones.
Thank you, gsi-kevincarrera and Otterlord, for getting this done to give Docs an issue-less New Year!

ematipico pushed a commit that referenced this pull request Jan 26, 2024
* Update Documentation: tsconfig.json Aliases

"Clarify in the documentation that tsconfig.json aliases are not supported in the astro.config.ts file. Suggest using relative paths for module imports in this file instead of tsconfig.json aliases."

* Actualizar configuring-astro.mdx

* Update configuring-astro.mdx

---------

Co-authored-by: Sarah Rainsberger <sarah@rainsberger.ca>
Co-authored-by: Reuben Tier <64310361+TheOtterlord@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

add new content Document something that is not in docs. May require testing, confirmation, or affect other pages. Merge Queue Approved and ready to be merged (wait for feature release if also labelled M-O-R)!

Projects

None yet

Development

Successfully merging this pull request may close these issues.

compilerOptions.paths in tsconfig isn't respected for TypeScript Astro configs (astro.config.ts)

4 participants