frost-byte Posted January 31, 2019 Share Posted January 31, 2019 I've created my own variation of the Space Invaders game, but I started with the boiler plate repo on github. I've updated from melonjs 6.0 to 6.3. I'm having an issue with the output of the "grunt" command. Unfortunately the bundling of melon and my game source files will not run. When execution reaches game.onload(), the console throws an error saying that game is undefined. Everything works if I just copy my javascript files over and adjust the index.html to load them, instead of the js/app.min.js My question is, what is the proper way to bundle all the project now, so that I don't have this issue? (Incidentally I was also seeing an error about drawShape, a function I'm not even using, and that went away if I just used the unbundled and unminified melon.js) <script type="text/javascript"> me.device.onReady(function onReady() { game.onload(); }); </script> Quote Link to comment Share on other sites More sharing options...
obiot Posted February 1, 2019 Share Posted February 1, 2019 Thanks, i will look into it, but only tomorrow Quote Link to comment Share on other sites More sharing options...
frost-byte Posted February 2, 2019 Author Share Posted February 2, 2019 On a whim I decided to try using webpack instead of grunt. After a lot of tinkering around, including some refactoring of my code to ES6, I'm able to generate a bundle/dist that works. The only thing that remains is figuring out how/if I should bother bundling the assets in the data folder. (Even without that, I"m working on adjusting the webpack config to properly copy the assets) Quote Link to comment Share on other sites More sharing options...
obiot Posted February 3, 2019 Share Posted February 3, 2019 I would love to move to yarn or web pack actually, including for the engine itself, but I just did not have the time to look at it. Quote Link to comment Share on other sites More sharing options...
obiot Posted March 5, 2019 Share Posted March 5, 2019 FYI I just finished replacing grunt by rollup to create our melonJS bundle. its pretty cool actually, and I can now truly external dependencies as they are and "bundle" at build time ! https://github.com/melonjs/melonJS/blob/master/rollup.config.js Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.