eduardoborges / use-mask-input

✏️ A react Hook for build elegant input masks. Compatible with React Hook Form
https://npmjs.com/package/use-mask-input
333 stars 19 forks source link

Missing type=module in package.json #44

Closed olafsulich closed 1 year ago

olafsulich commented 1 year ago

I ran into a problem with the library in my setup...

It appears to be caused by a missing type="module" in the package.json, because "main: "./dist/index.js" points to a file of type mjs. After adding the missing type, everything works as it should :)

What are your thoughts? Could you add this to package.json?

eduardoborges commented 1 year ago

I ran into a problem with the library in my setup...

It appears to be caused by a missing type="module" in the package.json, because "main: "./dist/index.js" points to a file of type mjs. After adding the missing type, everything works as it should :)

What are your thoughts? Could you add this to package.json?

Hey @olafsulich thanks about this.

I fixed on 3.3.1 Release. Tell me if worked for u.

olafsulich commented 1 year ago

Hey @eduardoborges, thanks for your quick reaction :)

My problem disappeared but another appeared - Inputmask is not a function

Live version: https://codesandbox.io/s/frosty-dream-npf7cn?from-embed

Zrzut ekranu 2023-08-4 o 10 30 09
olafsulich commented 1 year ago

Okay, I checked that and this problem has occurred since version 3.1.0, 3.0.6 works fine...

But it has another issue caused by the inputmask library. Because the 3.0.6 version has an old (5.0.7) version of inputmask, where this problem appeared. In the version of this package (5.0.9-beta.16), that the use-mask-input currently uses, it's already fixed.

eduardoborges commented 1 year ago

@olafsulich are u using vite, next or something?

olafsulich commented 1 year ago

@eduardoborges I'm using a custom Webpack config, but I checked it in the basic Create React App setup, and it's occurred also there

eduardoborges commented 1 year ago

@olafsulich I will release some beta versions, can you help me with some tests?

olafsulich commented 1 year ago

Sure :)

I believe all my problems are directly related to the Inputmask library, not your library code. What I discovered is:

  1. Using Create React App, you can eject (👎) and create a Webpack alias for inputmask inputmask: "node_modules/dist/inputmask.es6.js, then everything works correctly. 2 But if you try this with SSR React code (my custom webpack setup) it doesn't work. Then the problem is window is not defined, here is the issue in inputmask repo - https://github.com/RobinHerbots/Inputmask/issues/2628
eduardoborges commented 1 year ago

@olafsulich Im working im some workaround for these issues. :s

eduardoborges commented 1 year ago

@olafsulich Hey! Can you test 3.3.2 ?

olafsulich commented 1 year ago

@eduardoborges Hey, I don't know how you did it, but it works perfectly! Thank you for your commitment 🙏

eduardoborges commented 1 year ago

@olafsulich yyaaaay!!!