This repository has been archived by the owner on Jan 30, 2023. It is now read-only.
Global object (window) confusion #186
Labels
documentation
Improvements or additions to documentation
enhancement
New feature or request
good first issue
Good for newcomers
help wanted
Extra attention is needed
Milestone
Describe the bug
Readme states that
MatomoTracker
instance may be initialized like soand later uses syntax without window:
however latter doesn't work (at least in rollup builds) as it holds es-module wrapper
{__esModule: true, default: ƒ}
.Same object is also leaking viawindow.MatomoTracker_1
.IMHO it's not necessary to set class on window object, as it's already exported via IIFE in rollup config.
To Reproduce
As in description
Expected behavior
When importing MatomoTracker it's possible to initialize it via
new MatomoTracker({})
.The
window.MatomoTracker
property is available when using ES5 prebuiltbundle.min.js
.Screenshots
N/A
Desktop (please complete the following information):
N/A
Smartphone (please complete the following information):
N/A
Additional context
Proposed solution:
When running
yarn run build
, rollup shows warnings related to this issue:This is caused by exporting both default and named exports together in index.ts:
I wonder do we need to export types (here)?
I'd recommend removing types from index.ts and defining in package.json
Related commit: c6c2324
The text was updated successfully, but these errors were encountered: