Jump to content

WebStorm2016.2+Phaser+error with require()


sebamawa
 Share

Recommended Posts

Friends, greetings to all.
Return to Phaser after a while. I'm working with WebStorm and TypeScript.

I have a problem with importing a class into a .ts (typescript) file:
Import EnemySprite from './classes/EnemySprite';

Translated to javascript:
Var EnemySprite_1 = require ( './ classes / EnemySprite');

The require () function is not recognized, so when I run the game I get the following message in the index.html:
Uncaught ReferenceError: require is not defined

Some help?
Thank you!

Link to comment
Share on other sites

Thanks Luiz,
The problem is that I do not know what library to import.
What's more, I do not have the node_modules directory in the project. To add it to a Phaser project?

Back time worked with javascript hard, but now Typescript feel more comfortable, but right now I'm a little lost.

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...