Allow typescript import alias with tsc-alias
Palaxx opened this issue · comments
Hello,
I'm trying to use borp
in our codebase which use typescript aliases configured in tsconfig.json
, but unlucky alias are not actually supported and the following codes throws this error Error: Cannot find module '@app/add.ts
//src/add.ts
export function add (x: number, y: number): number {
return x + y
}
//test/add.test.ts
import { test } from 'node:test'
import { add } from '@app/add'
import { strictEqual } from 'node:assert'
test('add', () => {
strictEqual(add(1, 2), 3)
})
{
"$schema": "https://json.schemastore.org/tsconfig",
"compilerOptions": {
"outDir": "dist",
"sourceMap": true,
"target": "ES2022",
"module": "NodeNext",
"moduleResolution": "NodeNext",
"esModuleInterop": true,
"strict": true,
"resolveJsonModule": true,
"removeComments": true,
"newLine": "lf",
"noUnusedLocals": true,
"noFallthroughCasesInSwitch": true,
"isolatedModules": true,
"forceConsistentCasingInFileNames": true,
"skipLibCheck": true,
"lib": [
"ESNext"
],
"incremental": true,
"baseUrl": ".",
"paths": {
"@app/*": ["src/*"],
"@test/*": ["test/*"]
}
}
}
Can I try to open a PR to introduce a tsc-alias
step ?
as long as it's optional and generic enough to allow for more use cases, absolutely.