typings/index.d.ts
declare module "*.svg";
declare module "*.png";
declare module "*.jpg";
tsconfig.json
{
"compilerOptions": {
"module": "commonjs",
"target": "es5",
"declaration": true,
"outDir": "./dist"
},
"include": ["src/**/*", "typings/index.d.ts"]
}
When I run build
, it doesn't include the imported images.
The compiler won't include those files.
If you're using NPM for instance, you can copy them to your build directory by using a tool like copyfiles. Your build script would look something like that:
"scripts": {
"build": "tsc && copyfiles *.png build/images"
}
There are multiple ways to do this though, like using webpack.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With