beholdr / maska

Simple zero-dependency input mask for Vue, Svelte, Alpine.js and vanilla JS.
https://beholdr.github.io/maska/
MIT License
1.79k stars 71 forks source link

error on vue dev: Missing "./dist/types/mask-input" specifier in "maska" package [plugin vite:dep-scan] #218

Closed ricardovanlaarhoven closed 5 months ago

ricardovanlaarhoven commented 6 months ago

Describe the bug

on running (p)npm dev with vue and vite the following error is given:

  C:/Users/***/WebstormProjects/funders-app/index.html

  X [ERROR] Missing "./dist/types/mask-input" specifier in "maska" package [plugin vite:dep-scan]

    script:C:/Users/***/WebstormProjects/funders-app/src/shared/modules/form/components/DTextField.vue?id=0:40:7:
      40 │ import "maska/dist/types/mask-input"
         ╵        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

  This error came from the "onResolve" callback registered here:

    node_modules/.pnpm/esbuild@0.19.11/node_modules/esbuild/lib/main.js:1293:20:
      1293 │       let promise = setup({
           ╵                     ^

Steps to reproduce

With my exisiting installation of my existing project, this error is not thrown, on a clean intall on the same pc and on other pc's and 1 mac i've got this error. on 2.1.10 and 2.1.11

With a new vue project using the vue installtion guide, this error is also occuring.

beholdr commented 6 months ago

I have just released v3-beta. Could you check if this issue still actual?

LeanderD commented 6 months ago

I'm not having the issue in the OP, but I do have an issue with v3-beta. I tried the beta, but had to downgrade to v2.1.11.

I kept getting the error that the module or types couldn't be found. Cannot find module 'maska/vue' or its corresponding type declarations.

beholdr commented 6 months ago

@LeanderD could you please show how you include Maska?

LeanderD commented 6 months ago

For one of my components this is the import I have: import { vMaska, type MaskOptions } from 'maska/vue';

I'm using PNPM and in .npmrc I have: shamefully-hoist=true

beholdr commented 6 months ago

Try to import MaskOptions from 'maska':

import { vMaska } from 'maska/vue';
import { type MaskOptions } from 'maska';
LeanderD commented 5 months ago

I'm sorry for my late reply.

After updating to the latest beta everything is working for me.

beholdr commented 5 months ago

Thank you for feedback.