Skip to content

Fix Webpack compatibility#99

Open
MattiasBuelens wants to merge 4 commits intomainfrom
bugfix/webpack-esm
Open

Fix Webpack compatibility#99
MattiasBuelens wants to merge 4 commits intomainfrom
bugfix/webpack-esm

Conversation

@MattiasBuelens
Copy link
Contributor

Webpack seems to always select the UMD version using a require condition, whereas the ESM version is much more suitable for such bundlers.

I also revisited the fix from #95 to be more robust. We will now specifically look for the Conviva.Constants API to decide whether to use the default or namespace import when loading the Conviva SDK. This should be more robust.

@MattiasBuelens MattiasBuelens added the bug Something isn't working label Oct 24, 2025
@changeset-bot
Copy link

changeset-bot bot commented Oct 24, 2025

🦋 Changeset detected

Latest commit: 6e7da23

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 7 packages
Name Type
@theoplayer/adscript-connector-web Patch
@theoplayer/comscore-connector-web Patch
@theoplayer/conviva-connector-web Patch
@theoplayer/nielsen-connector-web Patch
@theoplayer/yospace-connector-web Patch
@theoplayer/gemius-connector-web Patch
@theoplayer/cmcd-connector-web Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@tvanlaerhoven
Copy link
Member

When importing through @theoplayer/react-native-analytics-conviva, and bundling with Webpack, I see it now takes the ESM module, but it still fails with:

conviva-connector.esm.js:2 Uncaught ReferenceError: exports is not defined
    at eval (conviva-connector.esm.js:2:23)
    at ./node_modules/@theoplayer/conviva-connector-web/dist/conviva-connector.esm.js (bundle.web.js:2162:1)
    at __webpack_require__ (bundle.web.js:6612:32)
    at fn (bundle.web.js:6819:21)
    at eval (ConvivaConnectorAdapter.web.js:1:651)
    at ./node_modules/@theoplayer/react-native-analytics-conviva/lib/module/internal/ConvivaConnectorAdapter.web.js (bundle.web.js:2206:1)
    at __webpack_require__ (bundle.web.js:6612:32)
    at fn (bundle.web.js:6819:21)
    at eval (ConvivaConnector.js:1:618)
    at ./node_modules/@theoplayer/react-native-analytics-conviva/lib/module/api/ConvivaConnector.js (bundle.web.js:2173:1)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

Comments