justkey007 / tsc-alias

Replace alias paths with relative paths after typescript compilation
MIT License
894 stars 62 forks source link

An error occurs when tsconfig extends is an array #172

Closed donniean closed 1 year ago

donniean commented 1 year ago

Since TypeScript 5.0, tsconfig extends could be an array.

In this case, an error occurs:

tsc-alias debug: Loading config file: '/PROJECT_DIRECTORY/tsconfig.json'
tsc-alias debug: configDir '/PROJECT_DIRECTORY'
tsc-alias debug: loaded config (from file): {
  baseUrl: '.',
  outDir: '/PROJECT_DIRECTORY/lib',
  paths: { '@/*': [ 'src/*', [length]: 1 ] }
}
/PROJECT_DIRECTORY/node_modules/tsc-alias/dist/helpers/config.js:113
        return Object.assign(Object.assign({}, (ext.startsWith('.')
                                                    ^

TypeError: ext.startsWith is not a function
    at loadConfig (/PROJECT_DIRECTORY/node_modules/tsc-alias/dist/helpers/config.js:113:53)
    at /PROJECT_DIRECTORY/node_modules/tsc-alias/dist/helpers/config.js:29:142
    at Generator.next (<anonymous>)
    at /PROJECT_DIRECTORY/node_modules/tsc-alias/dist/helpers/config.js:8:71
    at new Promise (<anonymous>)
    at __awaiter (/PROJECT_DIRECTORY/node_modules/tsc-alias/dist/helpers/config.js:4:12)
    at prepareConfig (/PROJECT_DIRECTORY/node_modules/tsc-alias/dist/helpers/config.js:21:12)
    at /PROJECT_DIRECTORY/node_modules/tsc-alias/dist/index.js:28:58
    at Generator.next (<anonymous>)
    at /PROJECT_DIRECTORY/node_modules/tsc-alias/dist/index.js:8:71

Node.js v18.15.0