In webpack using @ for root src folder:
import Home from '@/components/Home';
When try use '@', Parcel try install "@/..." package with npm. I use Windows.
I want some similar in parcel for avoid things such as "../../../" or similar, depends component path. Options?
Recommends?
Parcel supports / and ~/ they are documented in the docs. They have pretty similar results. (I think ~/ will be removed in parcel 2 though)
we dont and will not support @/ afaik because parcel 1 has been feature locked and because it鈥檚 non standardised. You鈥檒l be able to write your own resolver for parcel 2 if there is a need for @/
Try / and see if it works
Sent with GitHawk
@DeMoorJasper correct!
Fast summary, for users for this issue:
| Import path method | Comments | Parcel support |
|------------------------|-------------|-----------------|
| import Component from '@/components/Home' | non standard | no |
| import Component from '~/components/Home' | | yes, maybe removed in Parcel 2 |
| import Component from '/components/Home' | | yes |
Thanks!
Most helpful comment
@DeMoorJasper correct!
Fast summary, for users for this issue:
| Import path method | Comments | Parcel support |
|------------------------|-------------|-----------------|
|
import Component from '@/components/Home'| non standard | no ||
import Component from '~/components/Home'| | yes, maybe removed in Parcel 2 ||
import Component from '/components/Home'| | yes |Thanks!