frankleng / esbuild-ts-paths

Transform TS path aliases to absolute paths for esbuild

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

esbuild-ts-paths

Transform TS path alias to absolute paths for esbuild

Example

// tsconfig.json

"compilerOptions": {
  "outDir": "./dist",
    "baseUrl": ".",
    "paths": {
    "@common/*": ["../common/*"], // asterisks are important
    "@shared/*": ["./src/shared/*"]
  }
}
// esbuild
const tsPaths = require("esbuild-ts-paths") 
esbuild.build({
    //...
    plugins:[
        tsPaths(
            "./path/to/tsconfig.json" // optional, defaults to ./tsconfig.json
        )
    ]
})

About

Transform TS path aliases to absolute paths for esbuild

License:MIT License


Languages

Language:JavaScript 100.0%