typescript-paths
Resolving tsconfig paths in runtime
npm i typescript-paths
rollup.config.js
const { register } = require("typescript-paths")
register()
Example tsconfig.json
{
"compilerOptions": {
"paths": {
"~/*": ["./*"]
}
}
}
Then you can import alias instead of annoying path
import App from "~/App"
...
Options
tsConfigPath (string)
Specify set where your TypeScript configuration file.
If not set:
- use Environment variable TS_NODE_PROJECT
- or search tsconfig.json in current working directory.
logLevel ("warn" | "debug" | "none") (default: "warn")
Log level when the plugin is running.
reference