Skip to content

Allow typescript import alias with tsc-alias #21

@Palaxx

Description

@Palaxx

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 ?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions