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: Replace Rollup with Webpack for client JS bundling #249

Merged
merged 1 commit into from
Jun 13, 2019

Conversation

Robdel12
Copy link
Contributor

What is this?

The problem here is it's hard to get rollup to export our PercyAgent JS as a global on the window object. We added extend: true to the rollup config in #178 and thought that was the final fix. I wasn't thrilled that the compiled JS ended up being this.PercyAgent = ...., but it was good enough.

That is, until today. I was debugging snapshotting issues with a customer using the Capybara SDK. When we logged this from the driver.execute_script method, it returned a different library (Rollbar!!) and not the window object like we assume.

This PR replaces Rollup with Webpack because it's very easy to export directly to the window object. It also makes our testing more reliable since our test setup was using Webpack too. This now means our tests and prod code are being transpiled & bundled the same way.

TL;DR: We go from this:
image

To this:

image

Two main reasons:
- It's much easier to _make sure_ `PercyAgent` is being set on the `window`
object.
- Our tests use webpack (because rollup is hard for that), so it makes sense to
match prod with what we're bundling in tests
@Robdel12 Robdel12 requested a review from djones June 13, 2019 19:56
@Robdel12 Robdel12 changed the title Replace Rollup with Webpack for client JS bundling fix: Replace Rollup with Webpack for client JS bundling Jun 13, 2019
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

@Robdel12 Robdel12 merged commit 450c31e into master Jun 13, 2019
@delete-merged-branch delete-merged-branch bot deleted the rd/replace-rollup-webpack branch June 13, 2019 20:50
djones pushed a commit that referenced this pull request Jun 13, 2019
## [0.7.1](v0.7.0...v0.7.1) (2019-06-13)

### Bug Fixes

* Replace Rollup with Webpack for client JS bundling ([#249](#249)) ([450c31e](450c31e))
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.

None yet

2 participants