I created simple folder and using npm, I installed packages of pixi.js. Created html and js file. Then I copied some of the code from internet as simple as it could be. And using http-server, I am getting error on "cannot use import statement outside the module". I am beginner in the pixijs.
import * as PIXI from "pixi.js";
// application initialisation
const app = new PIXI.Application({
width: 800,
height: 600,
backgroundColor: 0x1099bb,
});
document.body.appendChild(app.view);
// text
const text = new PIXI.Text("Hello, world!");
text.x = 200;
text.y = 200;
text.style.fill = 0xffffff;
app.stage.addChild(text);
// graphic
const graphics = new PIXI.Graphics();
graphics.beginFill(0xff0000);
graphics.drawRect(300, 300, 100, 100);
graphics.endFill();
app.stage.addChild(graphics);
Showing error on the import statement.