Reputation: 187
I am developing an Angular application using IntelliJ IDEA. I run ng server in the terminal window. angular cli automatically recompile whenever I change any code, and causes the browser constantly reloading. I would like angular cli to recompile only when I click "build project" icon or press Ctrl+S. I have spent hours looking at both IntelliJ and angular cli, but could not find anything on how to make it happen. Please help if you know how
Upvotes: 5
Views: 7472
Reputation:
The cli does not compile unless a file is saved. Unless your IDE auto-saves there will be no reload prior to hitting Ctrl+S.
However you could still use the --no-live-reload
option to not reload the browser on change or --poll
to increase the timespan between the change detections.
Refer to the official documentation for the options.
Upvotes: 2
Reputation: 93748
Live Reload on saving is Angular CLI feature that can be disabled by passing --no-live-reload
to ng serve
. But it only rebuilds and reloads the page on explicit Save, not on each file change. To make it work on hitting Ctrl+S
only, you need to disable auto-saving in IDEA.
IDEA doesn't normally auto-save files on each key pressing. If it only happens while debugging your app, check if Live Edit (that is active during debug session) is enabled in Settings | Build, Execution, Deployment | Debugger | Live Edit - it auto-saves files to provide live reload.
Some other plugins can also be responsible for auto-saving - for example, third-party SonarLint and ESLint plugins are known for causing such issues, as they save files to run analysis on the changes, etc.
Upvotes: 4
Reputation: 1492
WebStorm actually has this written in the settings (Ctrl+Alt+S) - Appearance & Behavior - System Settings at the bottom of the page: "Autosave cannot be disabled completely. How it works" and the link takes you here https://www.jetbrains.com/help/webstorm/2021.3/saving-and-reverting-changes.html
Upvotes: 0
Reputation: 187
Finally find the settings in IntelliJ.
Go to [Settings ->Appearance & Behavior ->System Settings] and uncheck the following options:
Upvotes: 8