Skip to content

The package may have incorrect main/module/exports specified in its package.json #5879

@einarpersson

Description

@einarpersson

Past Issues Searched

  • I have searched open and closed issues to make sure that the bug has not yet been reported

Issue is a Bug Report

  • This is a bug report and not a feature request, nor asking for self-hosted support

Using official Plausible Cloud hosting or self-hosting?

Plausible Cloud from plausible.io

Describe the bug

I installed the npm package as described in the docs.

When running the dev server locally i get Failed to resolve entry for package "@plausible-analytics/tracker". The package may have incorrect main/module/exports specified in its package.json. in the logs. I cant even start the dev server.

I'm using vite 7.0.6

EDIT: Here is https://publint.dev/@plausible-analytics/[email protected] with some info, perhaps this is the issue:

"module": "./plausible.js" ,
pkg.module is used to output ESM, but pkg.exports is not defined. As Node.js doesn't read pkg.module, the ESM output may be skipped. Consider adding pkg.exports to export the ESM output. pkg.module can usually be removed alongside too. (This will be a breaking change) (More info)

EDIT 2: I realized that I should add some context on how I use it. I am using sveltekit and only callning init on mount (client side).

	import { init } from '@plausible-analytics/tracker'
	import { onMount } from 'svelte'

	const { children } = $props()

	onMount(() => {
		init({ domain: '<mydomain>' })
	})

Expected behavior

To work.

I have also tried deleting node_modules, package-lock.json and doing npm i without success.

Screenshots

No response

Environment

- OS: Fedora 42
- Browser: Firefox
- Browser Version: 144.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions