Ability to suppress `console.warn`s
Is your feature request related to a problem? Please describe. A lot of console warnings are logged to the browser's console when a registered bundle is not used on a loaded page.
We have a codebase where many React components are registered with ReactOnRails.register(), but not all the registered components are used on every page. The components which are not used on a particular page throw a warning in the browser's console to suggest cleaning them up. While I appreciate the intent behind having these messages during development, they're very noisy in production environments where one gets a ton of them.
Describe the solution you'd like It would be nice to have the ability to turn off console logging via a configuration option or to suppress them automatically in production environments.
Describe alternatives you've considered None
Additional context None
@kislakiruben Great idea. Thanks for the feedback. I'll get this into the next release.
What version are you on?
Any other issues?
@justin808 thank you for including this in a future release!
What version are you on?
We're on version 16.0
Any other issues?
Nothing of great concern so far, but I'll open another issue if anything else comes up.
We have a codebase where many React components are registered with ReactOnRails.register(), but not all the registered components are used on every page.
@kislakiruben Why not break your bundles down so that you only register the components used on the page?
That should reduce bundle size.
Is your team using Shakapacker?
Is your team using Shakapacker?
Hi, @Judahmeek! Yes, we're using Shakapacker.
@kislakiruben Why not break your bundles down so that you only register the components used on the page?
That should reduce bundle size.
We already have a lot of Rails helpers to render the React apps, so splitting them up further would add more verbosity to the code. Even though we'll eventually have to do that optimization (or implement auto-bundling), I think the main point still stands: the warnings are only helpful in dev environments, and there should be a way to turn them off for other environments. In our case, the logging systems for production were being spammed with these console.warns.