VeeValidate 4.x: Production build stripping validation rules
0 reputation · 23 Dec 2021, 14:25 UTC
In VeeValidate 4, the validation schema is defined via defineRule and applied to form components. Locally, when NODE_ENV=development, all rules are present and trigger as expected. In a production build, however, the same schema appears incomplete, causing validation to silently pass or fail without errors.
The observed discrepancy seems tied to the bundler’s minification process and VeeValidate’s internal rule registry, which may be pruned when the environment flag is set to production. This raises uncertainty about whether the library’s rule persistence is reliable across build modes and how to confirm that the schema is intact after bundling.
Key constraints include the need to maintain identical behavior between development and production, and the lack of explicit warnings when rules are omitted. The unresolved decision revolves around whether a configuration change or a library upgrade is required to preserve rule definitions in production.
What mechanisms within VeeValidate or the build pipeline cause validation rules to be omitted when NODE_ENV=production? How can we programmatically verify that the full rule set is present after minification? Is there a documented flag or plugin that ensures rule persistence in production builds?