Closed weaverryan closed 2 years ago
Hi @weaverryan thanks for this PR, small but can definitely save time for many people ! 😁 I just just think we should give access to this debug value from outside the index file. In case you have an other environment where the debug mode should be activate to. So what's you think about adding that to the bootstrap file in the recipe ? Or adding an argument to the startStimulusApp function to overwrite the debug value ?
Hey @WebMamba!
I'm not sure what use-case you have in mind, but I think it's not needed. You can always override this in your bootstrap.js
file if you need to:
import { startStimulusApp } from '@symfony/stimulus-bridge';
// Registers Stimulus controllers from controllers.json and in the controllers/ directory
export const app = startStimulusApp(require.context(
'@symfony/stimulus-bridge/lazy-controller-loader!./controllers',
true,
/\.[jt]sx?$/
));
+ // override however you want
+ app.debug = true;
// register any custom, 3rd party controllers here
// app.register('some_controller_name', SomeImportedController);
Cheers!
Ha yes your right ! My bad... 😁
Thanks @weaverryan.
Hi!
Well... this was such an easy win, we should have done it awhile ago :).
For a "dev" build, this activates Stimulus's debug mode, which outputs a lot of information to the log. Here is an example of a page with a single controller... and then after I activate an action on that controller:
When running
yarn encore production
(ornpm run encore production
), debug mode will be disabled. Heck, Weback is SO cool that, when building for production, the entire newif
statement is omitted (i.e. this adds 0 extra bytes to production builds).