Add module check to debug.js so that it doesn't error when included in browser environment