mixpanel-browser 2.74.0 → 2.75.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (37) hide show
  1. package/.github/workflows/unit-tests.yml +1 -1
  2. package/CHANGELOG.md +5 -0
  3. package/README.md +2 -2
  4. package/dist/mixpanel-core.cjs.js +318 -20
  5. package/dist/mixpanel-recorder.js +127 -15
  6. package/dist/mixpanel-recorder.min.js +1 -1
  7. package/dist/mixpanel-recorder.min.js.map +1 -1
  8. package/dist/mixpanel-targeting.js +2576 -0
  9. package/dist/mixpanel-targeting.min.js +2 -0
  10. package/dist/mixpanel-targeting.min.js.map +1 -0
  11. package/dist/mixpanel-with-async-modules.cjs.d.ts +522 -0
  12. package/dist/mixpanel-with-async-modules.cjs.js +9700 -0
  13. package/dist/mixpanel-with-async-recorder.cjs.js +318 -20
  14. package/dist/mixpanel-with-recorder.js +435 -26
  15. package/dist/mixpanel-with-recorder.min.js +1 -1
  16. package/dist/mixpanel.amd.js +1020 -28
  17. package/dist/mixpanel.cjs.js +1020 -28
  18. package/dist/mixpanel.globals.js +318 -20
  19. package/dist/mixpanel.min.js +179 -172
  20. package/dist/mixpanel.module.js +1020 -28
  21. package/dist/mixpanel.umd.js +1020 -28
  22. package/dist/rrweb-bundled.js +119 -5
  23. package/dist/rrweb-compiled.js +116 -5
  24. package/package.json +4 -3
  25. package/rollup.config.mjs +34 -2
  26. package/src/config.js +1 -1
  27. package/src/flags/index.js +269 -8
  28. package/src/globals.js +14 -0
  29. package/src/loaders/loader-module.js +1 -0
  30. package/src/mixpanel-core.js +12 -3
  31. package/src/recorder/index.js +2 -1
  32. package/src/targeting/event-matcher.js +97 -0
  33. package/src/targeting/index.js +11 -0
  34. package/src/targeting/loader.js +36 -0
  35. package/src/utils.js +1 -8
  36. package/.claude/settings.local.json +0 -12
  37. /package/src/loaders/{loader-module-with-async-recorder.js → loader-module-with-async-modules.js} +0 -0
@@ -301,13 +301,14 @@ class Mirror {
301
301
  return this.nodeMetaMap.get(n2) || null;
302
302
  }
303
303
  // removes the node from idNodeMap
304
- // doesn't remove the node from nodeMetaMap
305
- removeNodeFromMap(n2) {
304
+ // if permanent is true, also removes from nodeMetaMap
305
+ removeNodeFromMap(n2, permanent = false) {
306
306
  const id = this.getId(n2);
307
307
  this.idNodeMap.delete(id);
308
+ if (permanent) this.nodeMetaMap.delete(n2);
308
309
  if (n2.childNodes) {
309
310
  n2.childNodes.forEach(
310
- (childNode) => this.removeNodeFromMap(childNode)
311
+ (childNode) => this.removeNodeFromMap(childNode, permanent)
311
312
  );
312
313
  }
313
314
  }
@@ -8972,6 +8973,15 @@ class StyleSheetMirror {
8972
8973
  generateId() {
8973
8974
  return this.id++;
8974
8975
  }
8976
+ remove(stylesheet) {
8977
+ const id = this.styleIDMap.get(stylesheet);
8978
+ if (id !== void 0) {
8979
+ this.styleIDMap.delete(stylesheet);
8980
+ this.idStyleMap.delete(id);
8981
+ return true;
8982
+ }
8983
+ return false;
8984
+ }
8975
8985
  }
8976
8986
  function getShadowHost(n2) {
8977
8987
  var _a2;
@@ -9293,7 +9303,16 @@ class MutationBuffer {
9293
9303
  }
9294
9304
  };
9295
9305
  while (this.mapRemoves.length) {
9296
- this.mirror.removeNodeFromMap(this.mapRemoves.shift());
9306
+ const removedNode = this.mapRemoves.shift();
9307
+ if (removedNode.nodeName === "IFRAME") {
9308
+ try {
9309
+ this.iframeManager.removeIframe(removedNode);
9310
+ } catch (e2) {
9311
+ }
9312
+ } else {
9313
+ this.stylesheetManager.cleanupStylesheetsForRemovedNode(removedNode);
9314
+ }
9315
+ this.mirror.removeNodeFromMap(removedNode);
9297
9316
  }
9298
9317
  for (const n2 of this.movedSet) {
9299
9318
  if (isParentRemoved(this.removesSubTreeCache, n2, this.mirror) && !this.movedSet.has(index$2.parentNode(n2))) {
@@ -9654,6 +9673,9 @@ class MutationBuffer {
9654
9673
  this.shadowDomManager.reset();
9655
9674
  this.canvasManager.reset();
9656
9675
  }
9676
+ getDoc() {
9677
+ return this.doc;
9678
+ }
9657
9679
  }
9658
9680
  function deepDelete(addsSet, n2) {
9659
9681
  addsSet.delete(n2);
@@ -9747,6 +9769,14 @@ function initMutationObserver(options, rootEl) {
9747
9769
  });
9748
9770
  return observer;
9749
9771
  }
9772
+ function removeMutationBufferForDoc(doc) {
9773
+ for (let i2 = mutationBuffers.length - 1; i2 >= 0; i2--) {
9774
+ const buffer = mutationBuffers[i2];
9775
+ if (buffer.getDoc() === doc) {
9776
+ mutationBuffers.splice(i2, 1);
9777
+ }
9778
+ }
9779
+ }
9750
9780
  function initMoveObserver({
9751
9781
  mousemoveCb,
9752
9782
  sampling,
@@ -10795,6 +10825,8 @@ class IframeManager {
10795
10825
  __publicField$1(this, "crossOriginIframeMirror", new CrossOriginIframeMirror(genId));
10796
10826
  __publicField$1(this, "crossOriginIframeStyleMirror");
10797
10827
  __publicField$1(this, "crossOriginIframeRootIdMap", /* @__PURE__ */ new WeakMap());
10828
+ __publicField$1(this, "iframeContentDocumentMap", /* @__PURE__ */ new WeakMap());
10829
+ __publicField$1(this, "iframeObserverCleanupMap", /* @__PURE__ */ new WeakMap());
10798
10830
  __publicField$1(this, "mirror");
10799
10831
  __publicField$1(this, "mutationCb");
10800
10832
  __publicField$1(this, "wrappedEmit");
@@ -10820,6 +10852,32 @@ class IframeManager {
10820
10852
  if (iframeEl.contentWindow)
10821
10853
  this.crossOriginIframeMap.set(iframeEl.contentWindow, iframeEl);
10822
10854
  }
10855
+ getIframeContentDocument(iframeEl) {
10856
+ return this.iframeContentDocumentMap.get(iframeEl);
10857
+ }
10858
+ setObserverCleanup(iframeEl, cleanup) {
10859
+ this.iframeObserverCleanupMap.set(iframeEl, cleanup);
10860
+ }
10861
+ getObserverCleanup(iframeEl) {
10862
+ return this.iframeObserverCleanupMap.get(iframeEl);
10863
+ }
10864
+ removeIframe(iframeEl) {
10865
+ const storedDoc = this.iframeContentDocumentMap.get(iframeEl);
10866
+ if (storedDoc) {
10867
+ this.stylesheetManager.cleanupStylesheetsForRemovedNode(storedDoc);
10868
+ this.mirror.removeNodeFromMap(storedDoc, true);
10869
+ }
10870
+ this.iframes.delete(iframeEl);
10871
+ this.iframeContentDocumentMap.delete(iframeEl);
10872
+ const observerCleanup = this.iframeObserverCleanupMap.get(iframeEl);
10873
+ if (observerCleanup) {
10874
+ try {
10875
+ observerCleanup();
10876
+ } catch (e2) {
10877
+ }
10878
+ this.iframeObserverCleanupMap.delete(iframeEl);
10879
+ }
10880
+ }
10823
10881
  addLoadListener(cb) {
10824
10882
  this.loadListener = cb;
10825
10883
  }
@@ -10838,6 +10896,9 @@ class IframeManager {
10838
10896
  attributes: [],
10839
10897
  isAttachIframe: true
10840
10898
  });
10899
+ if (iframeEl.contentDocument) {
10900
+ this.iframeContentDocumentMap.set(iframeEl, iframeEl.contentDocument);
10901
+ }
10841
10902
  if (this.recordCrossOriginIframes)
10842
10903
  (_a2 = iframeEl.contentWindow) == null ? void 0 : _a2.addEventListener(
10843
10904
  "message",
@@ -11722,6 +11783,41 @@ class StylesheetManager {
11722
11783
  this.styleMirror.reset();
11723
11784
  this.trackedLinkElements = /* @__PURE__ */ new WeakSet();
11724
11785
  }
11786
+ /**
11787
+ * Cleans up stylesheets associated with a removed node.
11788
+ *
11789
+ * @param removedNode - The node that was removed from the DOM.
11790
+ */
11791
+ cleanupStylesheetsForRemovedNode(removedNode) {
11792
+ try {
11793
+ if (removedNode.nodeType === Node.DOCUMENT_NODE) {
11794
+ const doc = removedNode;
11795
+ if (doc.adoptedStyleSheets) {
11796
+ for (const sheet of doc.adoptedStyleSheets) {
11797
+ this.styleMirror.remove(sheet);
11798
+ }
11799
+ }
11800
+ }
11801
+ if (removedNode.nodeName === "STYLE") {
11802
+ const styleEl = removedNode;
11803
+ if (styleEl.sheet) {
11804
+ this.styleMirror.remove(styleEl.sheet);
11805
+ }
11806
+ }
11807
+ if (removedNode.nodeName === "LINK" && removedNode.rel === "stylesheet") {
11808
+ const linkEl = removedNode;
11809
+ if (linkEl.sheet) {
11810
+ this.styleMirror.remove(linkEl.sheet);
11811
+ }
11812
+ }
11813
+ if (removedNode.childNodes) {
11814
+ removedNode.childNodes.forEach((child) => {
11815
+ this.cleanupStylesheetsForRemovedNode(child);
11816
+ });
11817
+ }
11818
+ } catch (e2) {
11819
+ }
11820
+ }
11725
11821
  // TODO: take snapshot on stylesheet reload by applying event listener
11726
11822
  trackStylesheetInLinkElement(_linkEl) {
11727
11823
  }
@@ -12186,7 +12282,25 @@ function record(options = {}) {
12186
12282
  };
12187
12283
  iframeManager.addLoadListener((iframeEl) => {
12188
12284
  try {
12189
- handlers.push(observe(iframeEl.contentDocument));
12285
+ const iframeDoc = iframeEl.contentDocument;
12286
+ const iframeHandler = observe(iframeDoc);
12287
+ handlers.push(iframeHandler);
12288
+ const existingCleanup = iframeManager.getObserverCleanup(iframeEl);
12289
+ iframeManager.setObserverCleanup(iframeEl, () => {
12290
+ if (existingCleanup) {
12291
+ try {
12292
+ existingCleanup();
12293
+ } catch (e2) {
12294
+ }
12295
+ }
12296
+ try {
12297
+ iframeHandler();
12298
+ const idx = handlers.indexOf(iframeHandler);
12299
+ if (idx !== -1) handlers.splice(idx, 1);
12300
+ removeMutationBufferForDoc(iframeDoc);
12301
+ } catch (e2) {
12302
+ }
12303
+ });
12190
12304
  } catch (error) {
12191
12305
  console.warn(error);
12192
12306
  }
@@ -612,14 +612,16 @@ var Mirror = /*#__PURE__*/ function() {
612
612
  return this.nodeMetaMap.get(n2) || null;
613
613
  };
614
614
  // removes the node from idNodeMap
615
- // doesn't remove the node from nodeMetaMap
616
- _proto.removeNodeFromMap = function removeNodeFromMap(n2) {
615
+ // if permanent is true, also removes from nodeMetaMap
616
+ _proto.removeNodeFromMap = function removeNodeFromMap(n2, permanent) {
617
617
  var _this = this;
618
+ if (permanent === void 0) permanent = false;
618
619
  var id = this.getId(n2);
619
620
  this.idNodeMap.delete(id);
621
+ if (permanent) this.nodeMetaMap.delete(n2);
620
622
  if (n2.childNodes) {
621
623
  n2.childNodes.forEach(function(childNode) {
622
- return _this.removeNodeFromMap(childNode);
624
+ return _this.removeNodeFromMap(childNode, permanent);
623
625
  });
624
626
  }
625
627
  };
@@ -10361,6 +10363,15 @@ var StyleSheetMirror = /*#__PURE__*/ function() {
10361
10363
  _proto.generateId = function generateId() {
10362
10364
  return this.id++;
10363
10365
  };
10366
+ _proto.remove = function remove(stylesheet) {
10367
+ var id = this.styleIDMap.get(stylesheet);
10368
+ if (id !== void 0) {
10369
+ this.styleIDMap.delete(stylesheet);
10370
+ this.idStyleMap.delete(id);
10371
+ return true;
10372
+ }
10373
+ return false;
10374
+ };
10364
10375
  return StyleSheetMirror;
10365
10376
  }();
10366
10377
  function getShadowHost(n2) {
@@ -10683,7 +10694,15 @@ var MutationBuffer = /*#__PURE__*/ function() {
10683
10694
  }
10684
10695
  };
10685
10696
  while(_this.mapRemoves.length){
10686
- _this.mirror.removeNodeFromMap(_this.mapRemoves.shift());
10697
+ var removedNode = _this.mapRemoves.shift();
10698
+ if (removedNode.nodeName === "IFRAME") {
10699
+ try {
10700
+ _this.iframeManager.removeIframe(removedNode);
10701
+ } catch (e2) {}
10702
+ } else {
10703
+ _this.stylesheetManager.cleanupStylesheetsForRemovedNode(removedNode);
10704
+ }
10705
+ _this.mirror.removeNodeFromMap(removedNode);
10687
10706
  }
10688
10707
  for(var _iterator = _create_for_of_iterator_helper_loose(_this.movedSet), _step; !(_step = _iterator()).done;){
10689
10708
  var n2 = _step.value;
@@ -11057,6 +11076,9 @@ var MutationBuffer = /*#__PURE__*/ function() {
11057
11076
  this.shadowDomManager.reset();
11058
11077
  this.canvasManager.reset();
11059
11078
  };
11079
+ _proto.getDoc = function getDoc() {
11080
+ return this.doc;
11081
+ };
11060
11082
  return MutationBuffer;
11061
11083
  }();
11062
11084
  function deepDelete(addsSet, n2) {
@@ -11157,6 +11179,14 @@ function initMutationObserver(options, rootEl) {
11157
11179
  });
11158
11180
  return observer;
11159
11181
  }
11182
+ function removeMutationBufferForDoc(doc) {
11183
+ for(var i2 = mutationBuffers.length - 1; i2 >= 0; i2--){
11184
+ var buffer = mutationBuffers[i2];
11185
+ if (buffer.getDoc() === doc) {
11186
+ mutationBuffers.splice(i2, 1);
11187
+ }
11188
+ }
11189
+ }
11160
11190
  function initMoveObserver(param) {
11161
11191
  var mousemoveCb = param.mousemoveCb, sampling = param.sampling, doc = param.doc, mirror2 = param.mirror;
11162
11192
  if (sampling.mousemove === false) {
@@ -12172,6 +12202,8 @@ var IframeManager = /*#__PURE__*/ function() {
12172
12202
  __publicField$1(this, "crossOriginIframeMirror", new CrossOriginIframeMirror(genId));
12173
12203
  __publicField$1(this, "crossOriginIframeStyleMirror");
12174
12204
  __publicField$1(this, "crossOriginIframeRootIdMap", /* @__PURE__ */ new WeakMap());
12205
+ __publicField$1(this, "iframeContentDocumentMap", /* @__PURE__ */ new WeakMap());
12206
+ __publicField$1(this, "iframeObserverCleanupMap", /* @__PURE__ */ new WeakMap());
12175
12207
  __publicField$1(this, "mirror");
12176
12208
  __publicField$1(this, "mutationCb");
12177
12209
  __publicField$1(this, "wrappedEmit");
@@ -12193,6 +12225,31 @@ var IframeManager = /*#__PURE__*/ function() {
12193
12225
  this.iframes.set(iframeEl, true);
12194
12226
  if (iframeEl.contentWindow) this.crossOriginIframeMap.set(iframeEl.contentWindow, iframeEl);
12195
12227
  };
12228
+ _proto.getIframeContentDocument = function getIframeContentDocument(iframeEl) {
12229
+ return this.iframeContentDocumentMap.get(iframeEl);
12230
+ };
12231
+ _proto.setObserverCleanup = function setObserverCleanup(iframeEl, cleanup) {
12232
+ this.iframeObserverCleanupMap.set(iframeEl, cleanup);
12233
+ };
12234
+ _proto.getObserverCleanup = function getObserverCleanup(iframeEl) {
12235
+ return this.iframeObserverCleanupMap.get(iframeEl);
12236
+ };
12237
+ _proto.removeIframe = function removeIframe(iframeEl) {
12238
+ var storedDoc = this.iframeContentDocumentMap.get(iframeEl);
12239
+ if (storedDoc) {
12240
+ this.stylesheetManager.cleanupStylesheetsForRemovedNode(storedDoc);
12241
+ this.mirror.removeNodeFromMap(storedDoc, true);
12242
+ }
12243
+ this.iframes.delete(iframeEl);
12244
+ this.iframeContentDocumentMap.delete(iframeEl);
12245
+ var observerCleanup = this.iframeObserverCleanupMap.get(iframeEl);
12246
+ if (observerCleanup) {
12247
+ try {
12248
+ observerCleanup();
12249
+ } catch (e2) {}
12250
+ this.iframeObserverCleanupMap.delete(iframeEl);
12251
+ }
12252
+ };
12196
12253
  _proto.addLoadListener = function addLoadListener(cb) {
12197
12254
  this.loadListener = cb;
12198
12255
  };
@@ -12211,6 +12268,9 @@ var IframeManager = /*#__PURE__*/ function() {
12211
12268
  attributes: [],
12212
12269
  isAttachIframe: true
12213
12270
  });
12271
+ if (iframeEl.contentDocument) {
12272
+ this.iframeContentDocumentMap.set(iframeEl, iframeEl.contentDocument);
12273
+ }
12214
12274
  if (this.recordCrossOriginIframes) (_a2 = iframeEl.contentWindow) == null ? void 0 : _a2.addEventListener("message", this.handleMessage.bind(this));
12215
12275
  (_b = this.loadListener) == null ? void 0 : _b.call(this, iframeEl);
12216
12276
  if (iframeEl.contentDocument && iframeEl.contentDocument.adoptedStyleSheets && iframeEl.contentDocument.adoptedStyleSheets.length > 0) this.stylesheetManager.adoptStyleSheets(iframeEl.contentDocument.adoptedStyleSheets, this.mirror.getId(iframeEl.contentDocument));
@@ -13123,6 +13183,41 @@ var StylesheetManager = /*#__PURE__*/ function() {
13123
13183
  this.styleMirror.reset();
13124
13184
  this.trackedLinkElements = /* @__PURE__ */ new WeakSet();
13125
13185
  };
13186
+ /**
13187
+ * Cleans up stylesheets associated with a removed node.
13188
+ *
13189
+ * @param removedNode - The node that was removed from the DOM.
13190
+ */ _proto.cleanupStylesheetsForRemovedNode = function cleanupStylesheetsForRemovedNode(removedNode) {
13191
+ var _this = this;
13192
+ try {
13193
+ if (removedNode.nodeType === Node.DOCUMENT_NODE) {
13194
+ var doc = removedNode;
13195
+ if (doc.adoptedStyleSheets) {
13196
+ for(var _iterator = _create_for_of_iterator_helper_loose(doc.adoptedStyleSheets), _step; !(_step = _iterator()).done;){
13197
+ var sheet = _step.value;
13198
+ this.styleMirror.remove(sheet);
13199
+ }
13200
+ }
13201
+ }
13202
+ if (removedNode.nodeName === "STYLE") {
13203
+ var styleEl = removedNode;
13204
+ if (styleEl.sheet) {
13205
+ this.styleMirror.remove(styleEl.sheet);
13206
+ }
13207
+ }
13208
+ if (removedNode.nodeName === "LINK" && removedNode.rel === "stylesheet") {
13209
+ var linkEl = removedNode;
13210
+ if (linkEl.sheet) {
13211
+ this.styleMirror.remove(linkEl.sheet);
13212
+ }
13213
+ }
13214
+ if (removedNode.childNodes) {
13215
+ removedNode.childNodes.forEach(function(child) {
13216
+ _this.cleanupStylesheetsForRemovedNode(child);
13217
+ });
13218
+ }
13219
+ } catch (e2) {}
13220
+ };
13126
13221
  // TODO: take snapshot on stylesheet reload by applying event listener
13127
13222
  _proto.trackStylesheetInLinkElement = function trackStylesheetInLinkElement(_linkEl) {};
13128
13223
  return StylesheetManager;
@@ -13577,7 +13672,23 @@ function record(options) {
13577
13672
  };
13578
13673
  iframeManager.addLoadListener(function(iframeEl) {
13579
13674
  try {
13580
- handlers.push(observe(iframeEl.contentDocument));
13675
+ var iframeDoc = iframeEl.contentDocument;
13676
+ var iframeHandler = observe(iframeDoc);
13677
+ handlers.push(iframeHandler);
13678
+ var existingCleanup = iframeManager.getObserverCleanup(iframeEl);
13679
+ iframeManager.setObserverCleanup(iframeEl, function() {
13680
+ if (existingCleanup) {
13681
+ try {
13682
+ existingCleanup();
13683
+ } catch (e2) {}
13684
+ }
13685
+ try {
13686
+ iframeHandler();
13687
+ var idx = handlers.indexOf(iframeHandler);
13688
+ if (idx !== -1) handlers.splice(idx, 1);
13689
+ removeMutationBufferForDoc(iframeDoc);
13690
+ } catch (e2) {}
13691
+ });
13581
13692
  } catch (error) {
13582
13693
  console.warn(error);
13583
13694
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mixpanel-browser",
3
- "version": "2.74.0",
3
+ "version": "2.75.0",
4
4
  "description": "The official Mixpanel JavaScript browser client library",
5
5
  "main": "dist/mixpanel.cjs.js",
6
6
  "module": "dist/mixpanel.module.js",
@@ -91,7 +91,8 @@
91
91
  "webpack": "1.12.2"
92
92
  },
93
93
  "dependencies": {
94
- "@mixpanel/rrweb": "2.0.0-alpha.18.2",
95
- "@mixpanel/rrweb-plugin-console-record": "2.0.0-alpha.18.2"
94
+ "@mixpanel/rrweb": "2.0.0-alpha.18.3",
95
+ "@mixpanel/rrweb-plugin-console-record": "2.0.0-alpha.18.3",
96
+ "json-logic-js": "2.0.5"
96
97
  }
97
98
  }
package/rollup.config.mjs CHANGED
@@ -1,5 +1,6 @@
1
1
  import alias from '@rollup/plugin-alias';
2
2
  import closureCompiler from '@ampproject/rollup-plugin-closure-compiler';
3
+ import commonjs from '@rollup/plugin-commonjs';
3
4
  import fs from 'fs';
4
5
  import path from 'path';
5
6
  import esbuild from 'rollup-plugin-esbuild';
@@ -116,6 +117,30 @@ const MAIN_BUILDS = [
116
117
  plugins: [aliasRrweb()],
117
118
  },
118
119
 
120
+ // IIFE targeting bundle that is loaded asynchronously
121
+ {
122
+ input: `src/targeting/index.js`,
123
+ output: [
124
+ {
125
+ file: `build/mixpanel-targeting.js`,
126
+ name: `mixpanel_targeting`,
127
+ format: `iife`,
128
+ },
129
+ ...(MINIFY
130
+ ? [
131
+ {
132
+ file: `build/mixpanel-targeting.min.js`,
133
+ name: `mixpanel_targeting`,
134
+ format: `iife`,
135
+ plugins: [esbuild({target: `es5`, minify: true, sourceMap: true})],
136
+ sourcemap: true,
137
+ },
138
+ ]
139
+ : []),
140
+ ],
141
+ plugins: [commonjs(), nodeResolve({browser: true})],
142
+ },
143
+
119
144
  // IIFE main mixpanel build
120
145
  {
121
146
  input: `src/loaders/loader-globals.js`,
@@ -204,7 +229,7 @@ const ALL_BUILDS = [
204
229
  },
205
230
 
206
231
 
207
- // Modules builds that are bundled with the recorder
232
+ // Modules builds that are bundled with the recorder and targeting
208
233
  {
209
234
  input: `src/loaders/loader-module.js`,
210
235
  output: [
@@ -230,6 +255,7 @@ const ALL_BUILDS = [
230
255
  },
231
256
  ],
232
257
  plugins: [
258
+ commonjs(),
233
259
  aliasRrweb(),
234
260
  nodeResolve({
235
261
  browser: true,
@@ -262,8 +288,14 @@ const ALL_BUILDS = [
262
288
  ],
263
289
  },
264
290
  {
265
- input: `src/loaders/loader-module-with-async-recorder.js`,
291
+ input: `src/loaders/loader-module-with-async-modules.js`,
266
292
  output: [
293
+ {
294
+ file: `build/mixpanel-with-async-modules.cjs.js`,
295
+ name: `mixpanel`,
296
+ format: `cjs`,
297
+ },
298
+ // Backward compatibility: keep old output filename for existing users
267
299
  {
268
300
  file: `build/mixpanel-with-async-recorder.cjs.js`,
269
301
  name: `mixpanel`,
package/src/config.js CHANGED
@@ -1,6 +1,6 @@
1
1
  var Config = {
2
2
  DEBUG: false,
3
- LIB_VERSION: '2.74.0'
3
+ LIB_VERSION: '2.75.0'
4
4
  };
5
5
 
6
6
  export default Config;