As a newcomer to TypeScript, I recently implemented path mapping in my project. However, I encountered an issue when trying to read a JSON file for use as a fixture in some of my files.
To my surprise, the following code did not work:
const widgetFixture = require("@fixtures/widgets/widget.json");
Even though I defined my path mapping like this:
"@fixtures/*": ["lib/fixtures/*"],
All my other path mappings are functioning properly. Is there a more optimal way to reference this file located at {root}/lib/fixtures/widgets
? Can path mapping be used for such a file?