Skip to content

Message mapping on production build fails #13

Description

@mucenica-bogdan

Hello, there's a bug when build for production and the compiler (vite in my case) has function minification enabled.

In particular here: https://github.com/druc/intus/blob/master/lib/validation.js#L53

`${attributeToWildcard(attribute)}.${this.rules[attribute][rule].name}`

In this.rules[attribute][rule] you have a function, and when you call Function.name you expect to get the function name, which in case of this library means smth. You expect isRequired, isMin, etc.

But with the minification you get whatever the compiler choose for the function: ee, aa, a1.

Not really sure what the solution is for this. I guess you need a definition map for name to function in order to keep this link, as you can't really on the internal js function name.

Bogdan

subscribe @druc

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions