template-rollup-typescript
template-rollup-typescript copied to clipboard
Unable to find module '.assets/...'
Hi,
I have a Phaser 3 project in JS and I want to try to move it to typescript. Unfortunately, I am not able to figure out how to import image assets. I have tried a few different things from the web but nothing helps :( My imports currently look like this: import x from "./assets/x.png"
Could you please explain how to properly import assets?
@Qumeric you can try on preload method:
this.load.image('logo', 'assets/phaser3-logo.png');
then on create method:
const logo = this.add.image(400, 70, 'logo');
@Qumeric Having issue importing png, I found the solution by adding index.d.ts
with only the line declare module '*.png'
then in tsconfig.json : "include": [ "./src/**/*", "index.d.ts" ]