From e933df6cc6b25c00a64327334330b4b940aae208 Mon Sep 17 00:00:00 2001 From: Joey Parrish Date: Mon, 15 Nov 2021 09:54:37 -0800 Subject: [PATCH] fix: Fix window pollution in browser Fixes google/eme_logger#25 Also bumps version to 1.0.1 --- package.json | 2 +- trace-anything.js | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index abcedb2..27f9bf0 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "trace-anything", "description": "Shim and trace calls to absolutely anything", - "version": "1.0.0", + "version": "1.0.1", "homepage": "https://github.com/joeyparrish/trace-anything", "author": "Joey Parrish", "maintainers": [ diff --git a/trace-anything.js b/trace-anything.js index 63f27f4..86ff423 100644 --- a/trace-anything.js +++ b/trace-anything.js @@ -1140,4 +1140,8 @@ TraceAnything._newElementObserver = null; */ TraceAnything._nextGeneratedId = new Map(); -exports = {TraceAnything}; +// In a nodejs environment, export the module. In a browser, don't. +// See https://github.com/google/eme_logger/issues/25 +if (typeof module !== 'undefined') { + module.exports = {TraceAnything}; +}