Support absolute imports with `@`
See original GitHub issuewebpack.base.conf.js
wrote as below:
resolve: { extensions: ['.js', '.vue', '.json'], alias: { '@': resolve('src'), } },
https://github.com/vuejs-templates/webpack/blob/master/template/build/webpack.base.conf.js#L40
Can we use import Hello from '@/components/Hello'
like vue?
Issue Analytics
- State:
- Created 5 years ago
- Reactions:46
- Comments:44 (18 by maintainers)
Top Results From Across the Web
Making Life Easier with Absolute Imports - React in Javascript ...
Absolute imports make the component more readable and clean. There are cases like very closely related components where relative imports makes ...
Read more >Why and How to Use Absolute Imports in React
By using absolute imports, you can alias some folders to a name like below: import {MyComponent} from 'components/MyComponent';. Absolute ...
Read more >Absolute Import in React | create-react-app - BezKoder
Absolute imports help to simplify the paths because the paths is now relative to the project root directory or custom base directory. With ......
Read more >Absolute vs Relative Imports in Python
An absolute import specifies the resource to be imported using its full path from the project's root folder. Syntax and Practical Examples. Let's...
Read more >Absolute imports in Create React App - DEV Community
Absolute imports can help you make that code a lot cleaner, more readable and manageable. We want to be able to transform our...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
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 Hashnode Post
No results found
Top GitHub Comments
I’d say let’s just add
@
support. I was resistant because I thought we’d do monorepos sooner. But since that was shelved we might as well do what Vue does.There appears to be some confusion in other threads so I’ll repeat my comment from https://github.com/facebook/create-react-app/issues/5585:
Just to be clear — we do want to support absolute paths.
In particular, we want to:
NODE_PATH
work for TS. (https://github.com/facebook/create-react-app/issues/5692)@
alias work by default for everyone — both in JS and TS. (this issue)I’m sorry for the frustration this is causing. We’re not asking you to convert your code to use relative paths — but please wait for either of these two issues to resolve.