I guess once upon a time or even multiple times you have got an error regarding your javascript in Dynamics 365. Sometimes it could be regarding a field you use is getting removed, other times it could definitely be a dysfunctional JavaScript.
In Dynamics 365 Web Resources you have the option to add dependencies, in a Javascript web resource it could be ideal to add the fields you are using as dependencies. By doing this you will not be able to delete the field or the Javascript unless the dependency is removed.
To add a dependency to your Javascript. navigate to your javascript and click “Dependencies”
Now you will not be able to delete the depended fields before you remove the dependency. You are not able to import this Javascript to another environment without the field already being installed.