Closed olalonde closed 3 months ago
Fixed with this:
{
"compilerOptions": {
// ...
},
"tsc-alias": {
"debug": true,
"verbose": true,
"replacers": {
"base-url": {
"enabled": false
}
}
}
}
Reopening because that configuration broke some other stuff. I believe this is a bug.
if the module specifier is not a file path, tsc-alias shouldn't add a .js
extension even if there is a file with that name.
Ended up writing this: https://github.com/olalonde/tsc-module-loader
Was this by any chance where you had a file with the same name as something you were importing? In my case I had a file called react.ts of react tools with used import { useEffect, useRef, DependencyList, MutableRefObject, LegacyRef, RefCallback } from 'react'
. tsc-alias is still converting this to 'react.js'
.
Having the exact bug.
It's shocking that tsc
doesn't support the alias with the compiler out of the box.
Having the exact bug. It's shocking that
tsc
doesn't support the alias with the compiler out of the box.
It's not only that, there should also be an option for specifying the file extensions in the transpiled files, especially when you consider package.json
exports
demands that ESM and CJS files have different extensions.
The whole JS/CJS/ESM/node ecosystem is a mess TBH. It seems like an eternal process of trying to glue all the bits together.
I have a file
stripe.ts
which imports thestripe
module (npm install stripe). tsc-alias adds a .js extension to it for some reason.becomes