🛠 Heads up for [email protected] users getting Masked class is not found for provided mask #1131
yaberkane05
started this conversation in
General
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
If you're using a simple string-based mask like:
<IMaskInput mask="0000000000" />...and you're getting this error:
Uncaught Error: Masked class is not found for provided mask 0000000000, appropriate module needs to be imported manually before creating mask.➡️ It’s because, starting in [email protected], mask classes are no longer auto-registered for tree-shaking reasons.
✅ Fix
You must import the correct mask module manually based on the type of mask you're using.
For pattern masks (like "0000000000"), import this once, preferably in your main entry point:
import 'imask/esm/masked/pattern';💡 Other common mask types:
"0000000000" | import 'imask/esm/masked/pattern';
mask={Number} | import 'imask/esm/masked/number';
mask={Date} | import 'imask/esm/masked/date';
mask={/regex/} | import 'imask/esm/masked/regexp';
Hope this saves someone else the debugging time! 🚀
Feel free to 👍 or share if it helped.
Beta Was this translation helpful? Give feedback.
All reactions