Build project - pre and post actions
I have a question about the possibility of hooking an action before build (e.g. npm build).
Use case: in project where we have resource reloader (hot reload) we can just hit build project and changes appear without restarting the web server. However, we need to run npm build before that to compile JS distribution. Can't find a way to do that.
I tried to run npm build primarily and attach build project as post/after action. Can't find a way to do that, only before launch actions are available.
Last idea was to run neutral shell script with before launch actions (npm build and build project).
Thanks for your ideas/suggestions.
Please sign in to leave a comment.
So, you need running npm build before building the project? How do you build it - is there a specific configuration? What about adding npm build as 'before launch' task for your build?
Hi Elena,
I build it with Build Project (Cmnd+F9 on Mac). It's a java project so it runs compilation. These compilation changes are hot-reloaded into the JVM.
One of the resources is a JS distribution which needs to be repackaged by 'npm build'. I can't find a way how to pre-attach that to the Build Project command/action. Therefore I wanted to create a run configuration 'npm build' and tell it to invoke Build Project afterwards. Didn't find a way to do it, I only see before-launch options, not after.
I see... Unfortunately it's possible to specify neither 'before build' actions (https://youtrack.jetbrains.com/issue/IDEA-137487) nor 'after launch' ones (https://youtrack.jetbrains.com/issue/IDEA-132501)