beholdr / maska

Simple zero-dependency input mask for Alpine.js, Svelte, Vue.js and vanilla JS.

Home Page:https://beholdr.github.io/maska

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Maska v 2.1.1 not compatible with vue 2 ?

raphaelnoguier opened this issue · comments

Hello !

I try to update my vue 2 (nuxt 2.15) project from maska 1.5.1 to 2.1.1, but i have this error :

Capture d’écran 2022-12-16 à 11 40 27

I use it like suggested in the doc :

Capture d’écran 2022-12-16 à 11 42 48

Capture d’écran 2022-12-16 à 11 43 01

Any idea @beholdr ?

Thanks 🙂

Okay i managed to resolve this issue, if this could help someone :

I had to update my nuxt.config.js build object to :

build: {
  transpile: ['maska']
 }

Resolved by looking at this issue : nuxt/nuxt#9223 (comment)

Thanks !

This is also the solution to

Module parse failed: Unexpected token (21:129)                                                                                                                                                                                                                                    friendly-errors 14:32:49  
You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders
|     } else
|       s.tokens = O;
>     Array.isArray(s.mask) && (s.mask.length > 1 ? s.mask = [...s.mask].sort((e, a) => e.length - a.length) : s.mask = s.mask[0] ?? ""), s.mask === "" && (s.mask = null), this.opts = s;
|   }
|   masked(t) {

For anyone still using vue-cli, this is solved by setting

// vue.config.js
module.exports = {
  transpileDependencies: [
    'maska'
  ]
}