-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Parcel 2: Absolute path imports #3824
Comments
Using a tilde should work |
@mischnic Thanks! Is there another way without changing project's imports? |
Currently not |
You can write a custom resolver plugin that supports this. I'm fairly sure we do have a resolver for TypeScript specific stuff on the roadmap, so this should be supported someday... |
you can use |
@a-x- Worked like a charm, thank you! |
ok,solved my problem, very good,thanks |
Where do we need to apply this |
|
Any way to use it with jsconfig,json how to configure parcel according to jsconfig.json? |
❔ Question
How can I configure Parcel resolving absolute-like imports? I have a typescript project with imports relative to project's root folder, e.g.
import App from 'src/app/App'
(havingApp.tsx
inside ofsrc/app
folder).When trying to run
parcel serve src/index.tsx
I'm gettingError: Cannot find module 'src/app/App' from '/projects/projectFolder/src'
While
tsc -p tsconfig.json
works smoothly.I'm considering switching from Webpack to Parcel, but changing our imports from
src/...
to something like/src/...
or~/src/...
to overcome this problem seems as overhead.Below I provided simplified project settings.
Thanks for any feedback!
🔦 Context
Project structure
├── package.json
├── src
│ ├── index.tsx
│ └── app
│ ├── App.tsx
└── tsconfig.json
tsconfig.json:
package.json:
src/index.tsx:
🌍 Your Environment
The text was updated successfully, but these errors were encountered: