Hi there!,
Hope you’re having a good time, I’m studying the HTML5 Games Novice to Ninja Book on Sitepoint, but, when I try to compile with npm this error appears:
ParseError: ‘import’ and ‘export’ may appear only with ‘sourceType: module’
It happens just after the npm initialization and Budo installation. I didn’t install Babel, Gulp o anything yet.
import pop from "../pop/index.js"; // ERROR
const { Container } = pop;
// Game setup code
const scene = new Container();
// Example game element to manipulate
const player = {
update: function() {
console.log("updated!");
}
};
scene.add(player);
scene.update();
scene.remove(player);
console.log(scene.children);
I really don’t know what I’m doing wrong, so, any idea will be appreciated.
Thank’s in advance.
Regards,
Rodrigo