Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics


Create cool 2D games with a free game editor! · By Cosmo Myzrail Gorynych

importing a JS module dependency

A topic by cesarecontini created 22 days ago Views: 28 Replies: 3
Viewing posts 1 to 4

Hello there, 

is there any quick & easy way to include an NPM dependency into my project as I would in a nodeJS project? I.e. by running npm install some-package? 
If so where do you include the folder that's normally created in the 'node_modules' folder in a normal node project?




No, npm is not currently supported. You can add any libraries packed for browsers, though, by using Scripts section at the settings tab, or by putting files to includes folder (accessible from the hamburger menu at the top-left corner of ct.js).

(1 edit)

Thanks! If I include scripts into the 'includes' folder, say some package I download via bower, how do I include it into the game? Will it be available globally? Or via the scripts area within the settings section? An example would be very much appreciated! Thank you!


There is no automagic in this field, so you will need to use akatemplate module and put <script src="myscript.js"></script> tags there. Includes are copied as-is to the root of the exported project (you can browse it in ct.js folder/export), preserving directory structure.