Skip to content
This repository has been archived by the owner on Oct 15, 2022. It is now read-only.

Cannot load image onto canvas #7

Open
stevesmit opened this issue Aug 5, 2021 · 3 comments
Open

Cannot load image onto canvas #7

stevesmit opened this issue Aug 5, 2021 · 3 comments

Comments

@stevesmit
Copy link

When I try to follow along with the tutorial and load a .png onto the canvas, it displays a neon green block with a line through it. I placed the image in public/tiles/ and then loaded it at that location too:

this.load.image('tiles', 'tiles/faune.png')

I don't get any errors on the dev tools console either? It's very strange. The out the box example (where it loads the phaser logo) works just fine, probably because it is not loading it from my filesystem. It might be worth mentioning that I had to use v2.0.0 of Parcel because I couldn't get the previous version to install.

@alansegar
Copy link

I had this same issue when using Parcel v2 / #8
I think it's due to the parcel-plugin-static-files-copy devDependency on this line
https://github.com/ourcade/phaser3-typescript-parcel-template/blob/master/package.json#L24 not being compatible with Parcel v2.

If I change that line to "parcel-reporter-static-files-copy": "^1.3.0", and create a .parcelrc file containing the following:

{
  "extends": ["@parcel/config-default"],
  "reporters":  ["...", "parcel-reporter-static-files-copy"]
}

as described at https://github.com/elwin013/parcel-reporter-static-files-copy then it seems to serve from the local public folder successfully.

I also removed this line https://github.com/ourcade/phaser3-typescript-parcel-template/blob/master/package.json#L35 as there doesn't seem to be a watcher currently for v2.

@biskwikman
Copy link

@alansegar thanks for this! I was having the same issue and this works great.

@biskwikman
Copy link

I was able get it working while keeping the "parcel-reporter-static-files-copy" at 2.4.3 and keeping the "watcherGlob": "**" line. I just added .parcelrc file.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants