From f2e64450644d9581b21aded6f8f9615a1f4f3bf5 Mon Sep 17 00:00:00 2001 From: Robert DeLuca Date: Wed, 1 May 2019 17:46:20 -0500 Subject: [PATCH] fix: Build `PercyAgent` code that's inject in browser as iife We rely on the agent code we inject into the browser to be globally available on the window. There's no reason we need to distrubute the code we inject into the browser as a universal module. There are some cases where the site we inject the current agent code into that defines one of these modules (could be cjs, amd, or even the es6 module format). When that case happens it breaks out SDKs because `PercyAgent` is not defined. This commit changes the build to output an immediatly invoked function, which will always expose agent as a global --- rollup.config.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rollup.config.js b/rollup.config.js index 8d97bee8..0a698639 100644 --- a/rollup.config.js +++ b/rollup.config.js @@ -7,7 +7,7 @@ export default { output: { name: "PercyAgent", file: "dist/public/percy-agent.js", - format: "umd" + format: "iife" }, plugins: [ // Allows node_modules resolution