fingerprintjs/fingerprintjs-pro-react

Module not found: Error: Package path . is not exported from package

sross0988 opened this issue ยท 6 comments

I get this error locally:

ERROR in ./app/containers/SupportPage/index.tsx 43:34-83
Module not found: Error: Package path . is not exported from package /Users/sr/Documents/r2/node_modules/@fingerprintjs/fingerprintjs-pro-react (see exports field in /Users/sr/Documents/r2/node_modules/@fingerprintjs/fingerprintjs-pro-react/package.json)
 @ ./app/containers/Home/routes.tsx 54:38-71
 @ ./app/containers/Home/index.js 58:0-30 541:4-18 558:14-20 617:14-20 652:54-67
 @ ./app/containers/App/index.js 21:9-34
 @ ./app/app.js 45:0-33 101:38-41 109:40-112:3 109:2-112:4
node -v && npm -v
v18.14.2
9.6.0

Looking at this as the culprit: 4b0fe82

Particularly package.json:

  "exports": {
    "import": "dist/fp-pro-react.esm.js"
  },

The comment for the commit is fixes "appDir" problem in nextjs. I am not using nextjs, I am using webpack 5. Webpack is not liking this at all and I don't have the time to dive into a solution for y'all so letting you know here the issue it is giving.

The temporary solution for me was to downgrade to 2.2.0 via:

npm rm @fingerprintjs/fingerprintjs-pro-react && npm install --save @fingerprintjs/fingerprintjs-pro-react@2.2.x

Posting this for anyone else who runs into this so it also does not take too many seconds of your precious existence.

ilfa commented

Thank you for the issue.
I tried to reproduce and created this example in the fix-webpack-compatibility branch.

Can you provide more context about your problem? Do you use typescript or javascript source? What babel configuration do you use in case of javascript?

Or I can try to fix it with blind eyes using this webpack documentation page and ask you to test the prerelease.

+1, this issue is breaking our Jest tests with the error: No known conditions for "." entry in "@fingerprintjs/fingerprintjs-pro-react" package

I get this error when I attempt to mock the JS provider:

jest.mock("@fingerprintjs/fingerprintjs-pro-react", () => ({
  FpjsProvider: MockFpjsProvider,
}));
ilfa commented

@pondchamp @sross0988 can anyone test v2.3.1-test.1 prerelease with your case?

I tried downloading the prerelease and it appears to have fixed my issue! Thanks!

Sorry for the delay in getting back to you. Ah yes, this fixes it perfectly 8111970 Much appreciated. ๐ŸŒŸ

ilfa commented

Thank you for participating!

Fix released in v2.3.1