33
loading...
This website collects cookies to deliver better user experience
paths
and baseUrl
TypeScript Compiler options you will likely not have a great time moving - Parcel does not support these properties out of the box. This might be a huge problem for big codebases. You may also prefer TypeScript Compiler's way of handling absolute imports in your project to Parcel's ~
notation. This was the case for me so I decided to try out Parcel plugin ecosystem and create a Resolver Plugin of my own to solve this issue.parcel-resolver-ts-base-url
(name parcel-resolver-tspaths
was already taken by an outdated resolver). It has 0 dependencies (except for peer Parcel, of course), weighs barely over 1kb and uses memoization to speed up resolution processes.parcel-resolver-ts-base-url
using npm or yarn:npm i --save-dev parcel-resolver-ts-base-url
# or
yarn add -D parcel-resolver-ts-base-url
parcel-resolver-ts-base-url
to your .parcelrc
:{
"extends": "@parcel/config-default",
"resolvers": ["parcel-resolver-ts-base-url", "..."]
}
At the moment parcel doesn't provide a way I know of to specify tsconfig.json
location. Therefore parcel-resolver-ts-base-url
will use tsconfig.json
from the project root.
paths
property and projects baseUrl
and start building without ugly relative imports!parcel-resolver-ts-base-url
.baseUrl
importspaths
aliases without and with a single wildcardpaths
and baseUrl
imports resolving to a npm package with main
or module
fields/(c|m)?jsx?/
and /tsx?/
extensionsnode_modules
will not be resolved as external dependenciestsconfig.json
names and locations