In the past we encourgaed IIFE closures to avoid this causing problems. With the advent of packgeFiles and the removal of debug=1 (T367441), we are now in a situation where it would be nice to remove per-file closures (T50886), but the old style raw concatenation could cause problems, especially with ES6's const complaining about variables being redeclared.
Given that we have been linting these files as if they were in the global scope it is very unlikely that anyone is relying on this functionality, so we should probably just plug this leak with ES6 block scope wrappers { ... }.