TS path alias not resolving

In main/tsconfig.json I have the following path alias

{
  "compilerOptions": {
    "baseUrl": ".",
    "paths": {
      "@/*": ["./app/*", "./app/src/*"],
      "constants/*": ["./app/src/constants/*"],
    }
  }
}

where main/app/src/constants.js is as follows:

export const test = "abc";

I then try to reference this in main/app/routes/index.tsx as follows:

import {test} from '@constants';

but TS throws the error Cannot find module '@constants' or its corresponding type declarations.

Why is it failing to resolve the type alias and how can I fix this?