Hi there,
Just wanted to see if there was interest or acceptance for the idea of adding config to turn off production builds of Demo in react-component type?
I bring this up, because a project I am putting together has a consolidated Styleguide for demo'ing components. However, during dev, the demo environment is very useful. But I don't need it past npm start. That's my use case, which might not be that uncommon.
I wouldn't be averse to that, sounds reasonable.
We probably also need something to disable wrapping of propTypes with an environment check, as some people have use cases where they want to use propTypes in production (e.g. React Bootstrap uses them to mask props, someone building a UI lib with nwb might want to do likewise).
Still not sure of the cleanest way to configure all these off-toggles for default features. I added a polyfill toggle to the top-level config object to prevent the new default polyfills being added, wondering how ugly that gets as you increase the number default features you can turn off.
What do you think of making these all command-line feature toggles?
We already have some precedent with --preact (enable experimental build), --install (enable experimental dev tooling), --fallback (enable fallback serving for HTML5 History apps) and --reload (toggle a downstream feature on), none of which have any config file equivalent as being command line args lets you try them without any commitment (and you can add them to your package.json scripts if you decide you always want them).
Potential new toggles:
react-component projects:
--no-demo[-build]- turn demo build off--no-[wrap-]proptypes - turn propTypes environment check wrapping offreact-app/web-app projects:
--no-polyfill - turn off inclusion of default polyfills (replacing polyfill: false config, which can only ever have that value)--no-polyfill in every command for consistency--no-vendor[-bundle] - turn off automatic vendor bundle for anything from node_modules (replacing vendorBundle: false config, which can only ever have that value)I like your reasoning for cli toggles vs config file options.
Thanks for the validation _and_ going ahead to implement it!
Most helpful comment
What do you think of making these all command-line feature toggles?
We already have some precedent with
--preact(enable experimental build),--install(enable experimental dev tooling),--fallback(enable fallback serving for HTML5 History apps) and--reload(toggle a downstream feature on), none of which have any config file equivalent as being command line args lets you try them without any commitment (and you can add them to yourpackage.jsonscripts if you decide you always want them).Potential new toggles:
react-componentprojects:--no-demo[-build]- turn demo build off--no-[wrap-]proptypes- turnpropTypesenvironment check wrapping offreact-app/web-appprojects:polyfilling affects serving, build and testing, so it gets to be a special case, as you'd have to use--no-polyfill- turn off inclusion of default polyfills (replacingpolyfill: falseconfig, which can only ever have that value)--no-polyfillin every command for consistency--no-vendor[-bundle]- turn off automatic vendor bundle for anything fromnode_modules(replacingvendorBundle: falseconfig, which can only ever have that value)