lucasbasquerotto / react-masked-input

MIT License
28 stars 0 forks source link

Error: ENOENT: no such file or directory #4

Open carloscalage opened 10 months ago

carloscalage commented 10 months ago

Hey guys!

I just started to use this package on my project. I installed using pnpm install react-hook-mask , implemented and tested on my component. Everything went well and worked as expected, but after that I got 9 warnings like this one on my terminal:

...
WARNING in ../../node_modules/.pnpm/react-hook-mask@1.1.18_react-dom@18.2.0_react@18.2.0/node_modules/react-hook-mask/dist/esm/utils/mask.js
Module Warning (from ../../node_modules/.pnpm/source-map-loader@3.0.2_webpack@5.88.2/node_modules/source-map-loader/dist/cjs.js):
Failed to parse source map from '/..../node_modules/.pnpm/react-hook-mask@1.1.18_react-dom@18.2.0_react@18.2.0/node_modules/react-hook-mask/src/utils/mask.ts' file: Error: ENOENT: no such file or directory, open '/..../node_modules/.pnpm/react-hook-mask@1.1.18_react-dom@18.2.0_react@18.2.0/node_modules/react-hook-mask/src/utils/mask.ts'

webpack compiled with 9 warnings (3d483ff870fdd4f9)

I checked and it's trying to reach a folder at react-hook-mask/src and looking at this location I don't have this folder, just dist/.

So I don't know if this is something with me as I'm the only one having this problem here or maybe it's a bug with pnpm or NX. Can someone give me some help? I tried removing and installing again or just using pnpm install and still having this problem...

lucasbasquerotto commented 10 months ago

@carloscalage, I can see that you are using the latest version. I never saw the error you posted, but I also never used pnpm. Can you try using only npm and see if the error still happens, if the error goes away, it should be something to do with pnpm. If there is some setting to add to this library to avoid the error with pnpm, I may release a new version with the changes, but first I need to know what is causing that issue.

Regarding only having the dist folder, that is intentional and you can see it at https://www.npmjs.com/package/react-hook-mask?activeTab=code, but I can consider releasing the src code together if that solves the issue. My guess is that it's trying to find the source ts file from the mappings, but it's not found because it's not released in npm. That should be as simple as adding src at the "files": section in package.json.