leoasis / react-sound

Sound component to play audio in your web apps
ISC License
486 stars 80 forks source link

How to stop logs in console? #63

Open vandervidi opened 6 years ago

vandervidi commented 6 years ago

How to stop logs in console?

raychanks commented 6 years ago

If you are using webpack, you can add an alias to the configuration

module.exports = {
  resolve: {
    alias: { soundmanager2: 'soundmanager2/script/soundmanager2-nodebug-jsmin.js' }
  }
};

or just do the setup inside your sound component:

// inside YourReactSoundComponent.jsx
import Sound from 'react-sound';

and inside the constructor, set the debug option to false

constructor() {
  super();
  soundManager.setup({ debugMode: false });
}

I hope this help. You can find more details in #13.

baebb commented 5 years ago

it's

import Sound, { soundManager } from 'react-sound';

soundManager.setup({ debugMode: false });

and that doesn't work either. Why not just disable console logging by default? This the only lib i've ever had the (dis)pleasure of working with that does this.

andelizondo commented 5 years ago

Seriously @leoasis, how can we stop this???

Screenshot 2019-04-16 at 17 53 27
ThisIsSet-L commented 5 years ago

5992dfc should have fixed this. Messages should be suppressed in production builds of your React project.

quaternion7 commented 5 years ago

for me what worked was simply putting this on my App.tsx (I'm using typescript) (window as any).soundManager.setup({debugMode: false}); And if you are not using typescript you could simply set: window.soundManager.setup({debugMode: false});

leoasis commented 5 years ago

I'm happy to accept a PR that configures soundmanager to have debugMode set to false when it starts in development, and to update the documentation to specify how to set it up