Jump to content

typescript compiler in webstorm...


Recommended Posts

i use typesciprt plugin in my webstorm.



1. and when the .ts file compiled autoly,  it creates a .js.map file. what's mean of it?


2. and i see the class name in .ts is Vector3,  and in .js it's BABYLON.Vector3. 

i dont know how to set, i found it's Vector3 in my .js file compiled.

Link to comment
Share on other sites

1. This is source map file. It maps JS file lines to TS lines, so that you can debug TS directly in the browser or IDE. See more details here: http://www.aaron-powell.com/posts/2012-10-03-typescript-source-maps.html. If you don't need that, it is safe to ignore the files or disable their generation. 

thanks, i choose delete the argument '-sourcemap'...


2. i can use gulp to compile all ts. But how can i compile only one ts file when i make mofidy?

Link to comment
Share on other sites

2. i can use gulp to compile all ts. But how can i compile only one ts file when i make mofidy?

Webstorm comes with Typescript file watch/transpiler:
Every time you change a file, it will be automatically transpiled. 
However, you are probably using typescript "-out" (or equivalent gulp/grunt task) to combine everything to one javascript file. In this case you are out of luck, and can really do one of two things:
1. (this is what I do for now) Just disable file watch, and compile everything with gulp/grunt, even if you change a single file. Typescript compiler is relatively fast, it compiles in <2 seconds for me.
2. Generate separate javascript files with webstorm (and gulp for consistency). Then build your final game or load individual JS files with some external package manager (https://webpack.github.io/), which you can also invoke with gulp. I have not tried this path, but want to do that one day. 
Link to comment
Share on other sites

i think i didn't say clearly....

i add file watching and it's automatically compiled... i mean gulp compile all ts files is right, but webstorm auto compile one ts file is wrong... Can't find Vector3, Color3 or so on...



i use your first method now... for me, it's > 4 seconds...

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.

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.


  • Recently Browsing   0 members

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