analytics-debugger / ga4mp

GA4MP
MIT License
40 stars 12 forks source link

Failed to resolve entry for package #28

Open gavrashenko opened 8 months ago

gavrashenko commented 8 months ago

I'm facing an error while running unit tests (vitest):

Error: Failed to resolve entry for package "@analytics-debugger/ga4mp". The package may have incorrect main/module/exports specified in its package.json.

The issue is due to incorrect entries in the package.json:

"main": "dist/ga4mp.min.js", // 404 file
"module": "dist/ga4mp.esm.min.js", // ok
"browser": "dist/ga4mp.min.js", // 404 file

Pre-validation fails because of this. It can be easily fixed by using the correct files:

"main": "dist/ga4mp.umd.min.js",
"module": "dist/ga4mp.esm.min.js",
"browser": "dist/ga4mp.umd.min.js", // or iife as well

ga4mp version: v0.0.8 node: v20.9.0 vitest: v0.34.6

I temporarily resolved this issue by editing the package.json (replacing ga4mp.min.js with ga4mp.umd.min.js) in the postinstall script.