From 698067b82a551a7e7abf9c8efdc9061e5c40f288 Mon Sep 17 00:00:00 2001 From: Robert DeLuca Date: Fri, 3 May 2019 09:51:10 -0500 Subject: [PATCH] fix: Expose `PercyAgent` as a global always (#178) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Second time is the charm right? We're going to beta test this one but it should do it. Setting `extend: true` in the rollup config allows the bundler to extend the global namespace (window). So the output now looks like `this.PercyAgent = ` (where `this` is the window object) I cut a beta release of this and tested it on the various SDKs (btw, we need a better process for this): - https://github.com/percy/percy-cypress/compare/rd/agent-beta-4.4 - https://github.com/percy/percy-puppeteer/compare/rd/agent-beta-4.4 - https://github.com/percy/percy-nightwatch/compare/rd/agent-beta-4.4 - https://github.com/percy/percy-webdriverio/compare/rd/agent-beta-4.4 - https://github.com/percy/percy-nightmare/compare/rd/agent-beta-4.4 - https://github.com/percy/percy-protractor/compare/rd/agent-beta-4.4 - https://github.com/percy/percy-capybara/compare/rd/agent-beta-4.4 This one should do the trick 👍 --- rollup.config.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/rollup.config.js b/rollup.config.js index 8d97bee8..8b8199a5 100644 --- a/rollup.config.js +++ b/rollup.config.js @@ -7,7 +7,9 @@ export default { output: { name: "PercyAgent", file: "dist/public/percy-agent.js", - format: "umd" + format: "iife", + // a must to add `PercyAgent` to the global namespace + extend: true }, plugins: [ // Allows node_modules resolution