That tweet created some responses and since 140 chars is not enough to explain how to do it, I decided to posted here.
First and formost, if not properly done, blindly concatenating javascript files can cause problems and will prevent the rest of your code to execute. This is by design: the js code must halt when it encounters and exception. But there are places (read API) where this rule is encapsulated, meaning that the error will halt only the current stack of execution.
That's the main thing: do not call you code, ever, to run in the first stack execution.
Create simple "module", scoped into an IIFE, which ends with a semi-colon (always)