Skip to main content
GameDev.net gamedev.net

PRO Tired of ads? Read GameDev.net ad-free and help keep the community independent with GameDev Pro — $3/month.

Pixi.js and TypeScript AMD module compilation

Pixi.js and TypeScript AMD module compilation

8Observer8
8Observer8
My Instructions for beginners · · 1 min read
5,303 0

If you use Pixi with TypeScript maybe my information will be useful for you in the future when you compile to AMD modules.

I had a problem with import in TypeScript when I compiled using "module": "AMD". I had the error when I compiled like this: "cannot find pixi.js module". Because "." (dot) int the name does not allow to compile to AMD modules.

I solved this problem very easy. I just:

  1. renamed the folder "node_modules/pixi.js" to "node_modules/pixijs"
  2. replaced in the file "pixi.js.d.ts" this code:
declare module "pixi.js" {
    export = PIXI;
}

to this:

declare module "pixijs" {
    export = PIXI;
}

My example with instruction: https://github.com/8Observer8/getting-started-with-pixijs-and-typescript
Playground: https://next.plnkr.co/edit/2dkQtKRY30nvoYmF?preview

I hope it will help you.

Discussion

Loading comments...