Typescript aliases auto-import instead of absolutes paths
See original GitHub issueInfo
- Platform: macOS Mojave 10.14.4
- Vetur version: 0.20.0
- VS Code version: 1.33.1
Problem
Auto-import in .vue
files where typescript is enabled isn’t taking account of aliases defined in tsconfig.json.
It will write absolute paths whereas in .ts
files it works fine
In .vue
file
tsconfig.json
in .ts file
Issue Analytics
- State:
- Created 4 years ago
- Reactions:20
- Comments:5 (1 by maintainers)
Top Results From Across the Web
Typescript prefers importing relative import instead of path alias
What seems to help is to set paths to use ./ instead of @/ and use "typescript.preferences.importModuleSpecifier": "non-relative" setting in ...
Read more >Advanced Features: Absolute Imports and Module Path Aliases
Configure module path aliases that allow you to remap certain import paths. ... Note: jsconfig.json can be used when you don't use TypeScript....
Read more >Using absolute (alias) imports in Javascript and VSCode
Learn how to import javascript or typescript modules with absolute paths in webpack & VSCode. Developers love productivity hacks.
Read more >allow relative imports for files under path mappings - YouTrack
WEB-32466 Webstorm uses TS paths instead of plain old regular paths ... project) then IntelliJ autoimport always with absolute path. e.g. tsconfig.json.
Read more >Clean Up Your Imports using Absolute ... - DEV Community
For Create React App without using Craco ... The absolute import will only remove the relative path, but won't add @/ alias. For...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Duplicate of #1177, which is fixed by #1753.
Possibly discussed in #1177?
There, it’s labeled as a feature request; not sure exactly what work would be required on this