Releases: yakovlev-alexey/parcel-resolver-ts-base-url
Release 1.3.0
Release 1.3.0 makes tsconfig.json resolution compatible with Parcel itself and allows using this plugin within JS projects.
tsconfig.json resolution
From 1.3.0 parcel-resolver-ts-base-url will look for tsconfig.json
files starting from the import location going up the folder structure.
.
├── tsconfig.json
├── server
│ ├── tsconfig.json
│ └── index.ts # uses server/tsconfig.json
├── client
│ ├── tsconfig.json
│ └── index.ts # uses client/tsconfig.json
└── common
└── index.ts # uses ./tsconfig.json
This resolved #3
JavaScript imports
Previously parcel-resolver-ts-base-url would only work with imports happening in ts
or tsx
files. From now on just like TypeScript Compiler it will also resolve in JavaScript files.
This does not resolve #2 but should help using this plugin in your JavaScript Parcel projects.
Upcoming features
Next issue to be worked on is #4. At the moment extends
property in tsconfig.json
is ignored. Since the support for multiple tsconfig.json
in different directories was added it would make sense to allow having a base config extended in subdirectories.
I recently discovered that this package got somewhat popular on NPM. I am not using Parcel in any of my current project at work or outside of it. So if you are interested in collaborating on maintaining this project make sure to reach out to me!
Resource imports - 1.2.0
Release 1.2.0 adds a new feature, an important fix and covers the codebase with basic tests.
Resource imports
Now it is possible to have imports of files other than JavaScript/TypeScript ones. If you import a CSS or SASS file (or any other file with extension that exists) from TypeScript file you will not get an error:
import '@styles/button.css';
Now compiles 🚀
Invalid path resolutions without wildcards
Previously if your tsconfig.json
included an entry like "@urls": ["./urls"]
it would match for imports like import { URLS } from "@urlsavfd132"
. Since 1.2.0 such imports will no longer match.
Test coverage
I have added multiple test directories with different cases that this resolver should or should not be able to handle. From now on new features will be covered with tests. The solution to run tests is very low-tech and involves running a bash script joggling node_modules
around test benches.
Installing deps...
Deps installed
======================
Running test "base-url"...
TEST "base-url" SUCCESSFUL
======================
Running test "paths"...
TEST "paths" SUCCESSFUL
======================
Running test "base-url-paths"...
TEST "base-url-paths" SUCCESSFUL
...
I recently discovered that this package got somewhat popular on NPM. I am not using Parcel in any of my current project at work or outside of it. So if you are interested in collaborating on maintaining this project make sure to reach out to me!