Jump to content

Babylon and Typescript Compile error


jodo
 Share

Recommended Posts

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 ;)

 

 

Link to comment
Share on other sites

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 ;)

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

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