Let's say I have a folder with an image file and an index file (it acts like a public API), is there a way to reexport the image with another name?.
The folder structure is as following:
└── assets/
├── index.ts
└── facebook.png
Is there a way to reexport the image file with a name?, like the following:
index.ts:
export * as FacebookLogo from "./facebook.png"
Edit: The solution was to declare images file type in an module d.ts, following this answer.
enviroment.d.ts file:
declare module "*.png";
declare module "*.svg";
declare module "*.jpg";
declare module "*.jpeg";
CodePudding user response:
In the index.js
file of your api folder...
import FacebookLogo from './facebook.png';
export {
FacebookLogo,
/** other exports */
};