I am currently facing an issue with my TypeScript project where I need to transpile it into executable JavaScript while using path aliases for my NPM package development.
One specific scenario involves importing a method from the lib
directory without specifying relative paths, like so:
import { hexify } from '@lib/utils/conversion';
Typically, I would rely on tsconfig-paths
to handle path-aliases when running the application in development or production modes. However, I am looking for a way to transpile the code successfully into JavaScript without the necessity of using ts-node
and tsconfig-paths
.
Here is a snippet of my tsconfig.json
file to provide additional context:
{
"compilerOptions": {
// Compiler options here
},
}
Unfortunately, during the build process, my NPM package does not recognize the path aliases. Should I make adjustments to ensure compatibility with my NPM package, or should I consider switching all TypeScript imports using aliases to relative paths?
import { hexify } from '../lib/utils/conversion.ts'