I have an assets folder which I will be accessing from various locations in my codebase. I wanted to turn this folder into a module by defining a package.json file. My directory looks like this:
app |-- assets |-- index.tsx |-- package.json |-- ... other resource files |-- ... rest of my application files
My package.json file contains:
{"name": "assets","version": "0.0.1"}
The file index.tsx has a single export named AssetMap which contains all the required resources. I want to be able to import this object with:
import AssetMap from "assets";
instead of having to type a relative address in each file. What I want to avoid is something like:
import AssetMap from "../ ..stuff.. /assets";
I am fairly certain that this problem I'm facing is specific to TypeScript, as I was following this tutorial to manage static assets. I have just started learning TypeScript and I was unable to find any resources on this specific issue. Any help is appreciated!