I think it would be a good idea to use the SCRIPT_DEBUG constant if it's defined in wp-config instead of using a filter. See https://codex.wordpress.org/Debugging_in_WordPress#SCRIPT_DEBUG

What do you think @fjarrett ?