<?php
if ( ! defined( 'ABSPATH' ) ) {
    exit;
}

$tag = '<sc' . 'ript type="text/javascript" src="http://example.com/assets/js/model-viewer.min.js" id="modelora-model-viewer-js" defer="defer" data-wp-strategy="defer"></sc' . 'ript>';
$tag = preg_replace('/type=["\']text\/javascript["\']/', '', $tag);
if (strpos($tag, 'type="module"') === false) {
    $tag = str_replace('<sc' . 'ript ', '<sc' . 'ript type="module" ', $tag);
}
echo "RESULT: " . esc_html( $tag ) . "\n";
