Closed
Description
OS?
macOS Sierra (version 10.12)
Versions.
angular-cli: 1.0.0-beta.17
node: 4.4.7
os: darwin x64
Repro steps.
- ng new pixi-test
- npm install [email protected] --save
- npm install @types/pixi.js --save-dev
- Copy the following code into app.component.ts (from the PixiJS examples here):
import { Component, OnInit } from '@angular/core';
import * as PIXI from 'pixi.js';
@Component({
selector: 'app-root',
templateUrl: './app.component.html',
styleUrls: ['./app.component.css']
})
export class AppComponent implements OnInit {
renderer: any;
bunny: PIXI.Sprite;
stage: PIXI.Container;
ngOnInit() {
this.renderer = PIXI.autoDetectRenderer(800, 600, { backgroundColor: 0x1099bb });
document.body.appendChild(this.renderer.view);
// create the root of the scene graph
this.stage = new PIXI.Container();
// create a texture from an image path
const texture = PIXI.Texture.fromImage('assets/bunny.png');
// create a new Sprite using the texture
this.bunny = new PIXI.Sprite(texture);
// center the sprite's anchor point
this.bunny.anchor.x = 0.5;
this.bunny.anchor.y = 0.5;
// move the sprite to the center of the screen
this.bunny.position.x = 200;
this.bunny.position.y = 150;
this.stage.addChild(this.bunny);
// start animating
this.animate();
}
animate() {
requestAnimationFrame(this.animate.bind(this));
// just for fun, let's rotate mr rabbit a little
this.bunny.rotation += 0.1;
// render the container
this.renderer.render(this.stage);
}
}
- ng serve
The log given by the failure.
ERROR in [default] src/app/app.component.ts:2:22
Cannot find module 'pixi.js'.
Mention any other details that might be useful.
This seems to be a transient error since the example code runs correctly in the browser once webpack has finished generating the bundle.
Any help would be greatly appreciated.