Safely change module without losing change at module update I'm using the Image_Widget_Crop module for a Drupal 8 website. In this module there is a .js file setting the default values for Cropper.

Drupal.ImageWidgetCropType.prototype.defaultOptions = {
    autoCropArea: 1,
    background: false,
    responsive: false,
    viewMode: 1,
    zoomable: false
  };


I want to add a setting without putting it in the module so when updating my change doesn't get lost, how can I do this?

I want it to look like this.

Drupal.ImageWidgetCropType.prototype.defaultOptions = {
    autoCropArea: 1,
    background: false,
    responsive: false,
    viewMode: 1,
    zoomable: false,
    toggleDragModeOnDblclick: false
  };
Add your own library with a JS file, make sure the file has a weight higher than the image widget crop's JS file, then simply monkey patch the existing object like so:

Drupal.ImageWidgetCropType.prototype.defaultOptions.toggleDragModeOnDblclick = false;