pixijs / pixi-projection

MIT License
191 stars 34 forks source link

Issue with typescript and declaration file #81

Closed MercurialUroboros closed 4 years ago

MercurialUroboros commented 4 years ago

Hello. I'm using Pixi 5.3.3 with typescript 3.9.7 and webpack.

I'm facing an issue with pixi-projection declaration file.

Basically typescript is complaining about a declaration file being filled with actual code...and it's actually right about it.

Is there any solution for this? Apart from trying to make my ts ignore that .d file?

Regards

ivanpopelyshev commented 4 years ago

OMG, this again. Its problem for all my plugins. Gonna fix it soon :)

ivanpopelyshev commented 4 years ago

I fixed it before, i just forgot that we have two d.ts files, not one . Fixed, here and 0.3.14 npm.

MercurialUroboros commented 4 years ago

Thanks a lot for the fast fix!

laxman-spidey commented 4 years ago

@MercurialUroboros I was also facing the same issue earlier. Now it's gone. No compilation errors, but i'm still getting below error

Uncaught ReferenceError: PIXI is not defined
    js pixi-projection.js:36

even after adding these lines before import. Can you help me how you solved this issue? (it's happening with other plugins as well) global.PIXI = PIXI; window.PIXI = PIXI;

Note: I'm working on Angular 10, typescript 3.9

MercurialUroboros commented 4 years ago

Regardless of what you are working with, I believe it's something you have to define in your webpack. Have you tried this?

new webpack.ProvidePlugin({ PIXI: 'pixi.js' })

laxman-spidey commented 4 years ago

Modified angular to use custom webkit and configured the PIXI plugin with the line you have given then it worked. Thank you very much.