$wgResourceLoaderMaxQueryLength = -1;
/**
- * If set to true, JavaScript will be parsed prior to minification to validate it.
- * Parse errors will result in a JS exception being thrown during module load.
+ * If set to true, JavaScript modules loaded from wiki pages will be parsed prior
+ * to minification to validate it.
+ *
+ * Parse errors will result in a JS exception being thrown during module load,
+ * which avoids breaking other modules loaded in the same request.
*/
$wgResourceLoaderValidateJS = true;
+/**
+ * If set to true, statically-sourced (file-backed) JavaScript resources will
+ * be parsed for validity before being bundled up into ResourceLoader modules.
+ *
+ * This can be helpful for development by providing better error messages in
+ * default (non-debug) mode, but JavaScript parsing is slow and memory hungry
+ * and may fail on large pre-bundled frameworks.
+ */
+$wgResourceLoaderValidateStaticJS = false;
+
/** @} */ # End of resource loader settings }
* @return String: Concatenated and remapped JavaScript data from $scripts
*/
protected function readScriptFiles( array $scripts ) {
+ global $wgResourceLoaderValidateStaticJS;
if ( empty( $scripts ) ) {
return '';
}
if ( $contents === false ) {
throw new MWException( __METHOD__.": script file not found: \"$localPath\"" );
}
- $contents = $this->validateScriptFile( $fileName, $contents );
+ if ( $wgResourceLoaderValidateStaticJS ) {
+ // Static files don't really need to be checked as often; unlike
+ // on-wiki module they shouldn't change unexpectedly without
+ // admin interference.
+ $contents = $this->validateScriptFile( $fileName, $contents );
+ }
$js .= $contents . "\n";
}
return $js;