Deregister Vue as a Dependency

File Upload Pro utilizes Vue as the backing framework for its JavaScript on both the frontend and in the form editor. In the event that File Upload Pro’s bundled version of Vue is conflicting with another registered version of Vue, it can be deregistered using the following snippet.

Code

Filename: gpfup-deregister-vue-as-a-dependency.php

<?php
/**
 * Gravity Perks // File Upload Pro // Deregister Vue as a Dependency
 * https://gravitywiz.com/documentation/gravity-forms-file-upload-pro/
 *
 * File Upload Pro utilizes Vue as the backing framework for its JavaScript
 * on both the frontend and in the form editor. In the event that File Upload Pro’s
 * bundled version of Vue is conflicting with another registered version of Vue,
 * it can be deregistered using the following snippet.
 */
add_filter( 'gpfup_scripts', function ( $scripts ) {
	foreach ( $scripts as &$script ) {
		if ( $script['handle'] !== 'gp-file-upload-pro' ) {
			continue;
		}

		$script['deps'] = array_diff( $script['deps'], array( 'gravityperks-vue-2' ) );
	}

	return $scripts;
} );

Leave a Reply

Your email address will not be published. Required fields are marked *

  • Trouble installing this snippet? See our troubleshooting tips.
  • Need to include code? Create a gist and link to it in your comment.
  • Reporting a bug? Provide a URL where this issue can be recreated.

By commenting, I understand that I may receive emails related to Gravity Wiz and can unsubscribe at any time.