I am currently working on developing a compact FOSS UI component library specifically for the Phaser.io game engine. The code repository can be found here. All the components are stored in the src/
directory and are exported through the index.js
file. These components are bundled using webpack.config.js
and then exported to build/phaser-ui.js
.
The challenge I am facing involves utilizing the compiled file. Within the test/
folder, I have set up a Phaser Game for testing with the help of the phaser-plus Yeoman generator. The package phaser-ui
is included in the test's package.json using a relative link, which seems to be functioning correctly.
The underlying issue revolves around my phaser-ui
file not having access to the Phaser Library. In the test game, I am attempting to import a component from the phaser-ui package.json dependency, resulting in an error being thrown.
Code snippet inside the Game.js state:
import ProgressBar from "phaser-ui";
https://i.sstatic.net/5dPDb.png https://i.sstatic.net/6DCGo.png
For further discussion, check out this post on the HTML5 Game Dev Forums here. The source repository can also be accessed here.