Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Build PercyAgent code that's inject in browser as iife #176

Merged
merged 1 commit into from
May 2, 2019

Conversation

Robdel12
Copy link
Contributor

@Robdel12 Robdel12 commented May 1, 2019

What is this?

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 distribute 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 immediately invoked function, which will always expose agent as a global.

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
Copy link
Contributor

@djones djones left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🍍 LGTM.

Let's trigger Dependabot on our example projects once this ships to make sure everything continues to work well.

@Robdel12 Robdel12 merged commit 9f1ac26 into master May 2, 2019
@Robdel12 Robdel12 deleted the rd/non-umd branch May 2, 2019 15:12
djones pushed a commit that referenced this pull request May 2, 2019
## [0.4.2](v0.4.1...v0.4.2) (2019-05-02)

### Bug Fixes

* Build `PercyAgent` code that's inject in browser as iife ([#176](#176)) ([9f1ac26](9f1ac26))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants