Hey! Absolutely love this framework - thank you so much for all your work on it!
I'm using this on top of Nuxt and want to create a static page using nuxt generate, which doesn't allow me to change NODE_ENV. I want to include the vanilla debug panel in this static page, but there's no way to do so since it's guarded by NODE_ENV !== 'production'.
Can there be a forceDebug option or something similar in the client setup just like the debug option? If forceDebug was set to true the debug panel would be included regardless of the NODE_ENV.
// debug panel stripped out in production
new Client({
debug: true
})
// debug panel included in production
new Client({
debug: true,
forceDebug: true
})
Alternately, debug could be the final say on whether the debug panel is included:
// include debug panel in all environments
new Client({
debug: true
})
// mimic current behavior
new Client({
debug: process.env.NODE_ENV !== 'production'
})
I'd be happy to submit a PR for either version - let me know your thoughts. Thanks again!
Hey @SaFrMo!
There is one other consideration: we don't want the Debug Panel code to even appear in the final bundle of a game that doesn't need it. So, the option to include / strip it has to be available at bundling time (which is what process.env.NODE_ENV does).
One way to solve this might be to allow the user to import the Debug Panel from a separate package if they really want to include it in an environment that has NODE_ENV set to 'production':
import { DebugPanel } form 'boardgame.io/debug';
Client({
// this forces the debug panel to render regardless of the environment
debug: DebugPanel,
})
What do you think?
@nicolodavis Noted, that reasoning absolutely makes sense - and I love that solution, that'd work perfectly! Is that a quick change on your end or something you'd like a PR for? Thanks for the quick response, much appreciated!
It's an easy change that I can make in the next couple of weeks when I have some time.
Fantastic, thank you so much!
This is implemented in https://github.com/nicolodavis/boardgame.io/commit/e7d47ee85fea676b4f30efa1e10607958e5398af and will be available in the next release.
Wonderful, thank you so much for this!
For anyone finding this issue, the correct usage example is:
import { Debug } from 'boardgame.io/debug';
const client = Client({
debug: { impl: Debug },
});
As seen in the https://github.com/nicolodavis/boardgame.io/commit/e7d47ee85fea676b4f30efa1e10607958e5398af commit description.
Most helpful comment
For anyone finding this issue, the correct usage example is:
As seen in the https://github.com/nicolodavis/boardgame.io/commit/e7d47ee85fea676b4f30efa1e10607958e5398af commit description.