Only load JS files if they're needed.