How can I apply new changes when edit JS file in production?

If you want managed and persistent changes to core code that live beyond a rebuild you have four options:

  • (maintain a) Fork (forget it, nasty amount of maintenance) - you’d only do this if you didn’t know about the next three options or were too lazy to learn about them :sleeping_face:
  • Plugin (Ruby & Rails, CSS, Javascript, templates & assets) - front end and back end.
  • Theme Component (JavaScript, CSS, Templates and assets) - front end only.
  • PR to core! :wink:

For you Theme Component appears to be the right approach. Put the time in to learn how to use them and you will be rewarded.

It may initially look like extra hassle but they are super convenient and you can update, enable and disable Theme Components online without rebuiding. Very handy! Currently the only main limitation they have is a lack of test support iirc.