Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

There are types at '/app/node_modules/@thumbmarkjs/thumbmarkjs/dist/types/index.d.ts', but this result could not be resolved when respecting package.json "exports". The '@thumbmarkjs/thumbmarkjs' library may need to update its package.json or typings. #25

Closed
deadcoder0904 opened this issue Mar 4, 2024 · 5 comments

Comments

@deadcoder0904
Copy link

deadcoder0904 commented Mar 4, 2024

v0.13.5 works. all versions after that break.

my code in next.js that used to work:

"use client"

import React from "react"
import { hasWindow } from "std-env"

import { useStore } from "@app/store/zustand"

export function Fingerprint() {
	const { setFingerprint } = useStore()

	React.useEffect(() => {
		async function fn() {
			if (hasWindow) {
				const { getFingerprint } = await import("@thumbmarkjs/thumbmarkjs")
				const visitorId = await getFingerprint()
				setFingerprint(visitorId)
			}
		}

		fn()
	}, [setFingerprint])
	return null
}

fwiw, i tried this recommended example too but it gives error on import only.

@ilkkapeltola
Copy link
Collaborator

Yeah, this seems to be a typings issue with how rollup was set up. I'll see where that one went wrong.

@ilkkapeltola
Copy link
Collaborator

I was able to reproduce now, so, fix is coming.

@deadcoder0904
Copy link
Author

that's nice. waiting for it.

@ilkkapeltola
Copy link
Collaborator

Done.

@deadcoder0904
Copy link
Author

works now.

"use client"

import { getFingerprint } from "@thumbmarkjs/thumbmarkjs"
import consola from "consola"
import React from "react"
import { hasWindow } from "std-env"

import { useStore } from "@app/store/zustand"

export function Fingerprint() {
	const { setFingerprint } = useStore()

	React.useEffect(() => {
		async function fn() {
			if (hasWindow) {
				getFingerprint()
					.then((visitorId) => {
						setFingerprint(visitorId)
					})
					.catch((error) => {
						consola.error("Error getting fingerprint:", error)
					})
			}
		}

		fn()
	}, [setFingerprint])
	return null
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants