🪟 Windows TippsThe Gemini desktop app is now available for Windows(11.09.2026 um 17:06 Uhr)
🕵️ SicherheitslückenBurn Out, Or Fade Away(14.09.2026 um 14:25 Uhr)
⚠️ Malware / Trojaner / VirenWindows 11 just dropped the tool ransomware abused, Microsoft says don’t restore WMIC(10.09.2026 um 20:11 Uhr)
⚠️ Malware / Trojaner / VirenWindows 11: Microsoft entfernt WMIC-Tool gegen Ransomware - ad-hoc-news.de(14.09.2026 um 07:58 Uhr)
🕵️ SicherheitslückenMicrosoft schließt Rekordzahl an Sicherheitslücken - techbook(14.09.2026 um 09:00 Uhr)
🪟 Windows TippsThe Gemini desktop app is now available for Windows(11.09.2026 um 17:06 Uhr)
🕵️ SicherheitslückenBurn Out, Or Fade Away(14.09.2026 um 14:25 Uhr)
⚠️ Malware / Trojaner / VirenWindows 11 just dropped the tool ransomware abused, Microsoft says don’t restore WMIC(10.09.2026 um 20:11 Uhr)
⚠️ Malware / Trojaner / VirenWindows 11: Microsoft entfernt WMIC-Tool gegen Ransomware - ad-hoc-news.de(14.09.2026 um 07:58 Uhr)
🕵️ SicherheitslückenMicrosoft schließt Rekordzahl an Sicherheitslücken - techbook(14.09.2026 um 09:00 Uhr)

🔧 Programmierung 🕛 vor 1 Jahr 2 Min Lesezeit
0

Shortening import paths (path aliases) in vite-react-ts with NX mono-repos.

↗ Quelle (dev.to)
🗣️ Stimme:
📑 Inhaltsübersicht

The aliases (shortened paths) need to be set in both the root tsconfig.base.json and vite.config.ts files.




  • vite.config.ts will be used at compile time to tell the vite compiler where your files are located. Its critical that both are set up correctly.

  • tsconfig is required so typescript knows where the file can be found for intellisense and automatic imports.



The way tsconfig.json files extend one another can cause confusion when setting up path aliases in monorepo projects. Therefore its critical we add out aliases to the tsconfig.base.json file in the root of the mono-repo, not in the tsconfig.json file found in individual apps.




The "extends" property of a tsconfig.json file is poorly named. The properties of the file being extended (often tsconfig.base.json) are overridden not extended.




To add custom path aliases the following pattern can be used.






1. Add the path alias to the tsconfig.base.json file in the root of the monorepo.






CODE
{
"compilerOptions": {
"paths": {
"@<project-name>/<import-alias>": [
"apps/<app-name>/<path-to-dir>"
]
}
}
}








  • @<project-name>/<import-alias> is the shortened, readable import path you will use in your files. eg: import {FileName} from '@<project-name>/<import-alias>'


  • apps/<app-name>/<path-to-dir> is the directory that you wish to alias (relative to the tsconfig.base.json file location)



the @ symbol is not required, but it is the standard pattern to prepend the aliases when using nx.






2. Add a path alias to the vite.config.ts file inside the app(s) you will be using the alias.






CODE
export default defineConfig({
resolve: {
alias: {
'@<project-name>/<import-alias>': '<path-to-dir>'
},
}
});








  • @<project-name>/<import-alias> is the same alias as used in the tsconfig file and should match exactly.


  • <path-to-dir> is the directory which you wish to alias. NB: this is relative to the location of the vite.config.ts file so the path will be different from the one used in tsconfig.base.json. usually src/path/to/directory



This setup should allow you to user shortened aliases, which act as absolute imports in your Vite-React Typescript projects.



Goodbye import {filename} from '../../../../relative/import/that/breaks/all/the/time'

Vollständiger Original-Bericht
Ausführliche Details, Code-Beispiele & Hersteller-Stellungnahme auf dev.to.
↗ Original-Artikel auf dev.to lesen
Wie bewertest du diesen Beitrag?
1 Klick Feedback
Teilen mit Netzwerk & Team:

Community-Analysen & Experten-Meinungen 0

Verfasse deine eigene Analyse, teile Workarounds oder diskutiere diesen Vorfall im Blog.
Noch keine Community-Analyse verfasst. Markiere einen Textabschnitt oder klicke oben auf Eigene Analyse verfassen“!
Community Pulse: Relevanz-Einschätzung
1 Klick Experten-Votum
🔴 Akute Relevanz 0%
🟡 In Evaluierung 0%
🟢 Keine Auswirkung 0%
Spannende Innovation 0%
Verwandte Story-Cluster & Quellen (Vektor-KI)
Port 8095 Engine
1 Quelle
The Gemini desktop app is now available for Windows
1 Quelle
Burn Out, Or Fade Away
1 Quelle
Windows 11 just dropped the tool ransomware abused, Microsoft says don’t restore WMIC
Ähnliche Beiträge
🔍 Verwandte News

Auch interessante Nachrichten Shortening import paths (path aliases) in vite-react-ts with NX mono-repos.

Thematisch verwandte Begriffe: Shortening, import, paths, path · 6 Treffer

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...