jodo Posted January 29, 2016 Share Posted January 29, 2016 My project for that evening was to try out Typescript a little bit to actually code something on the babylon framework. I did some tutorials and it seems really cool! Then I took the src Folder from Babylon added it to my Project Folder and wanted to compile and I got these errors: EDIT: Okay i managed to compile without errors. Than when using the javascript file I got that error when running in the Browser. I figgured that in the tsconfig.json the "module" should probably not commonjs but amd (it is some sort of require.js right?). But it didnt resolve the proble : / TypeError: BABYLON is undefined I am guessing there is something wrong with my config files... but I dont know what. I couldnt find any info online that helped me :/. I am using Visual Studio Code by the way. This would be the tsconfig.json { "compilerOptions": { "target": "es6", "module": "commonjs", "sourceMap": true, "out": "babylon_myBuild.js" } } And this is my task.json { "version": "0.1.0", // The command is tsc. Assumes that tsc has been installed using npm install -g typescript "command": "tsc", // The command is a shell script "isShellCommand": true, // Show the output window always "showOutput": "always", // Tell the tsc compiler to use the tsconfig.json from the open folder. "args": ["-p", "."], // use the standard tsc problem matcher to find compile problems // in the output. "problemMatcher": "$tsc" } Also what does the *.d.ts file mean? Would be cool if somebody could point me to the right direction Quote Link to comment Share on other sites More sharing options...
jerome Posted January 30, 2016 Share Posted January 30, 2016 I personaly compile with the provided gulp script Go to Babylon.js/Tools/Gulp Then run "gulp typescript" This will compile everything, minify it, etc. You will find the new compiled files then in /Babylon.js/dist/preview release/ jodo 1 Quote Link to comment Share on other sites More sharing options...
jodo Posted January 30, 2016 Author Share Posted January 30, 2016 that worked! Thanks. Quote Link to comment Share on other sites More sharing options...
jodo Posted January 30, 2016 Author Share Posted January 30, 2016 Is it posible to just compile one typescript file to a javascript file? Because when using the gulp.js file and for example using the command "glup typescript" it takes like 4 minutes to compile the whole thing :(. As I am not quite new to both typescript and babylon and have to try out a lot of stuff, but waiting 4 minutes every time is quite time consuming ^^. Or are you working on the js files and when you know everything is working fine with the js files you convert it into the typescript files? Edit: using "gulp typscript-compile" and adding the single js files is quite a bit faster ... still takes some time. Maybe its just my super old and slow laptop Quote Link to comment Share on other sites More sharing options...
jerome Posted January 30, 2016 Share Posted January 30, 2016 the whole compilation is only about 12" on the computer I develop on. I only code in TS and only compile everything each time. don't know about the way to compile only one file with the TS declarations taken in account... some TS expert will answer you here Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted February 1, 2016 Share Posted February 1, 2016 woot 4 minutes! I do exactly like jerome Other great solution: install visual studio 2015 community which integrates a native TS compiler which compiles every single file when they are modified Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted February 1, 2016 Share Posted February 1, 2016 You can also launch "gulp watch" to have gulp watches your file and compiles when required 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.