npm still compile while typing
While I'm typing code in my typescript file, npm compiles many times. Sometimes it's broken and down, so I have to start it again.
In the past, npm only compiles when I save or unactive IntelliJ. It's really convenient. So anyone knows why and how to fix this.
I'm using IntelliJ IDEA 2017.1.5.
Thanks!
请先登录再写评论。
Please can you clarify what you mean by npm compiling? Do you have TypeScript compiler enabled (Settings | Languages & Frameworks | TypeScript, Enable TypeScript Compiler)?
Thanks for your comment!
"npm compiling"? I mean that npm builds the code I had just written and deploys it immediatly (I think it's called "hot swap"). At that time I had enabled Typescript compiler, and especially check Track changes option bellow.
And now I uncheck that option, I realize that IDE just compile my code when I press Ctrl+S or unactive IDE's window. However, I'm still not sure about my trick. If you know exactly why, and how to config IDE to make it compile new code only when I press Ctrl+S or unactive it's window then please tell me about that.
Thank you so much! And sorry about my bad English :).
>I mean that npm builds the code I had just written and deploys it immediatly (I think it's called "hot swap")
npm itself can hardly build anything:) You must be using some build tools started with npm scripts, right?
>At that time I had enabled Typescript compiler, and especially check Track changes option bellow.
Built-in TypeScript compiler can't be run on Save; if Track changes option is enabled, it's triggered while you edit your code; if it's off, you need to run compiler explicitly using Compile button in Typescript tool window
> If you know exactly why, and how to config IDE to make it compile new code only when I press Ctrl+S or unactive it's window then please tell me about that.
You can set up your build tool to watch your files (most built tools/bundlers, like gulp, Gryunt, Webpack, ... support watch mode) and then hit Ctrl+S in WebStorm to trigger your build tool
Thanks Elena Pogorelova for your detailed answer!