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

Interaction tracking follow up #13509

Merged
merged 12 commits into from
Sep 1, 2018

Conversation

bvaughn
Copy link
Contributor

@bvaughn bvaughn commented Aug 29, 2018

Follow up for PR #13253. Resolves #13512

  • Reduce new dependencies by merging the new interaction-tracking package into the (not yet released) react-scheduler package (final name TBD).
  • Avoid breaking backwards compatibility.
    • The react-scheduler API has been inlined for UMD React bundle and re-exported via React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED so that renderers can safely use the new API without requiring any new <script> tags to be added. A UMD fork has been added to redirect react-scheduler imports to React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED instead.
    • This react-scheduler API has been re-exported from the shared NPM package for the CJS React bundle. I've added hard dependencies on react-scheduler to each reconciler renderer (e.g. react-dom, react-native, react-test-renderer) so that CJS updates will just work without requiring any additional npm install steps.
  • Enable the new API to be accessed from UMD bundles by adding a UMD bundle for the react-scheduler package that (lazily) forwards methods to the React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED export. Lazy forwards are important so that the <script> tags can be declared in the future-safe order (ie. react-scheduler before react).

All methods for the new react-scheduler package (including interaction tracking APIs) have been prefixed with "unstable_" since they're new and relatively unproven.

As part of this change, the react-scheduler code (which used to be inlined into individual renderers) has been moved to the react package. This makes it look like the react UMD bundle has grown more than it has (rather, there is a corresponding decrease in e.g. react-dom). Here are some diffs that show the various CJS and UMD changes (NOTE these diffs reflect suspense being enabled so they may be a bit larger than otherwise expected.)

I've added a new Rollup plugin (scripts/rollup/plugins/strip-unused-imports.js) to strip unused imports from production bundles so that production react-dom won't have any references to the tracking API.

I've also added a new fixture (fixtures/tracking/index.html and fixtures/tracking/script.js) to ensure that the UMD bundles are wired up correctly.

Non-blocking follow up work

  • Decide on a name for the react-scheduler package.
  • Decide on the version of the initial react-scheduler release and update package.jsons. (I assume 16.5 but for now I've left as 0.1).
  • Agree on the entry point names for tracking and tracking-subscription APIs. (Currently they're react-scheduler/tracking and react-scheduler/tracking-subscriptions but I'm not married to these.)

Copy link
Collaborator

@gaearon gaearon left a comment

Choose a reason for hiding this comment

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

Not opposed to this. But I think we should only merge once we've figured out why this happens on the Rollup side.


pureExternalModules.forEach(module => {
const regExp = new RegExp(
`(?<!= *)require\\(["']${module}["']\\)[,;]`,
Copy link
Collaborator

Choose a reason for hiding this comment

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

What does the first part of this do?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It's a negative look behind to make sure the required module isn't being assigned to a variable.

Copy link
Contributor Author

@bvaughn bvaughn Aug 29, 2018

Choose a reason for hiding this comment

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

To be clear, this is definitely a hack. ☹️ I'm just not sure how to strip the unused import any other way. And if it's important to us to avoid importing the 816 byte interaction-tracking production bundle, then we have to strip it.

@bvaughn
Copy link
Contributor Author

bvaughn commented Aug 29, 2018

Have we figured out why? It might be that we need to update Rollup to get some upstream bugfix. Or maybe there's something simple we can fix ourselves and send it to them.

No. I'm doing what the docs say to do wrt treeshake.pureExternalModules.

We can't update the Rollup version to see if it's fixed without addressing circular dependency issues between ReactFiberScheduler > ReactFiberBeginWork > ReactFiberClassComponent which I'd rather not tackle at the moment.

@bvaughn
Copy link
Contributor Author

bvaughn commented Aug 29, 2018

But I think we should only merge once we've figured out why this happens on the Rollup side.

As best I can tell, it just looks like a bug.

We're using Rollup 0.52.1 but the latest version is 0.65.0.

I don't think we can upgrade past 0.53 or 0.54 (I forget) without hitting the circular dependency issue, and that small upgrade doesn't fix the bug.

@pull-bot
Copy link

pull-bot commented Aug 29, 2018

React: size: 🔺+37.3%, gzip: 🔺+34.1%

ReactDOM: size: -2.1%, gzip: -2.6%

Details of bundled changes.

Comparing: 0452c9b...bc6f98f

react

File Filesize Diff Gzip Diff Prev Size Current Size Prev Gzip Current Gzip ENV
react.development.js +40.8% +36.2% 59.58 KB 83.89 KB 16.71 KB 22.76 KB UMD_DEV
react.production.min.js 🔺+37.3% 🔺+34.1% 6.99 KB 9.59 KB 2.96 KB 3.97 KB UMD_PROD
react.profiling.min.js n/a n/a 0 B 5.99 KB 0 B 2.57 KB NODE_PROFILING
React-profiling.js n/a n/a 0 B 13.91 KB 0 B 3.89 KB FB_WWW_PROFILING

react-dom

File Filesize Diff Gzip Diff Prev Size Current Size Prev Gzip Current Gzip ENV
react-dom.development.js -2.1% -2.4% 660.24 KB 646.54 KB 154.94 KB 151.28 KB UMD_DEV
react-dom.production.min.js -2.1% -2.6% 95.36 KB 93.32 KB 31.18 KB 30.37 KB UMD_PROD
react-dom.development.js -2.2% -2.5% 656.33 KB 641.85 KB 153.81 KB 149.91 KB NODE_DEV
react-dom.production.min.js -2.1% -2.5% 95.3 KB 93.28 KB 30.91 KB 30.13 KB NODE_PROD
ReactDOM-dev.js -0.0% 0.0% 663.69 KB 663.63 KB 151.92 KB 151.92 KB FB_WWW_DEV
ReactDOM-prod.js -0.0% -0.0% 287.74 KB 287.71 KB 53.32 KB 53.3 KB FB_WWW_PROD
react-dom.profiling.min.js -2.1% -2.4% 98.18 KB 96.14 KB 31.51 KB 30.75 KB NODE_PROFILING
ReactDOM-profiling.js +0.3% +0.1% 293.15 KB 294.13 KB 54.64 KB 54.68 KB FB_WWW_PROFILING

react-art

File Filesize Diff Gzip Diff Prev Size Current Size Prev Gzip Current Gzip ENV
react-art.development.js -3.1% -4.0% 452.83 KB 438.74 KB 102.41 KB 98.28 KB UMD_DEV
react-art.production.min.js -2.4% -2.9% 86.64 KB 84.58 KB 26.75 KB 25.98 KB UMD_PROD
react-art.development.js -3.9% -4.8% 385.38 KB 370.46 KB 85.32 KB 81.19 KB NODE_DEV
react-art.production.min.js -4.0% -5.4% 51.63 KB 49.54 KB 16.14 KB 15.27 KB NODE_PROD
ReactART-dev.js -0.1% -0.2% 375.79 KB 375.41 KB 80.13 KB 79.97 KB FB_WWW_DEV
ReactART-prod.js -0.0% -0.1% 159.89 KB 159.88 KB 27.14 KB 27.12 KB FB_WWW_PROD

react-test-renderer

File Filesize Diff Gzip Diff Prev Size Current Size Prev Gzip Current Gzip ENV
react-test-renderer.development.js +0.1% +0.2% 382.05 KB 382.52 KB 83.58 KB 83.77 KB UMD_DEV
react-test-renderer.production.min.js -0.2% -0.2% 50.83 KB 50.75 KB 15.54 KB 15.51 KB UMD_PROD
react-test-renderer.development.js -0.0% 0.0% 378.14 KB 378.01 KB 82.61 KB 82.64 KB NODE_DEV
react-test-renderer.production.min.js -0.1% -0.1% 50.49 KB 50.46 KB 15.36 KB 15.35 KB NODE_PROD
ReactTestRenderer-dev.js -0.0% 0.0% 383.26 KB 383.12 KB 81.66 KB 81.68 KB FB_WWW_DEV

react-scheduler

File Filesize Diff Gzip Diff Prev Size Current Size Prev Gzip Current Gzip ENV
react-scheduler.development.js +24.4% +23.6% 15.4 KB 19.17 KB 4.65 KB 5.74 KB UMD_DEV
react-scheduler.production.min.js 🔺+15.8% 🔺+21.0% 2.73 KB 3.16 KB 1.26 KB 1.53 KB UMD_PROD
react-scheduler.development.js +0.9% +0.3% 15.21 KB 15.35 KB 4.61 KB 4.62 KB NODE_DEV
react-scheduler.production.min.js 🔺+5.3% 🔺+1.2% 2.65 KB 2.79 KB 1.21 KB 1.22 KB NODE_PROD
ReactScheduler-dev.js +1.0% +0.4% 15.42 KB 15.57 KB 4.64 KB 4.66 KB FB_WWW_DEV
ReactScheduler-prod.js 🔺+1.9% 🔺+0.6% 7.58 KB 7.72 KB 1.89 KB 1.9 KB FB_WWW_PROD
react-scheduler-tracking.development.js n/a n/a 0 B 10.84 KB 0 B 2.63 KB NODE_DEV
react-scheduler-tracking.production.min.js n/a n/a 0 B 772 B 0 B 389 B NODE_PROD
react-scheduler-tracking.profiling.min.js n/a n/a 0 B 2.9 KB 0 B 1001 B NODE_PROFILING
ReactSchedulerTracking-dev.js n/a n/a 0 B 10.43 KB 0 B 2.35 KB FB_WWW_DEV
ReactSchedulerTracking-prod.js n/a n/a 0 B 949 B 0 B 428 B FB_WWW_PROD
ReactSchedulerTracking-profiling.js n/a n/a 0 B 6.8 KB 0 B 1.25 KB FB_WWW_PROFILING

react-native-renderer

File Filesize Diff Gzip Diff Prev Size Current Size Prev Gzip Current Gzip ENV
ReactNativeRenderer-dev.js -0.0% 0.0% 497.85 KB 497.7 KB 110.13 KB 110.15 KB RN_FB_DEV
ReactNativeRenderer-prod.js -0.0% -0.0% 214.78 KB 214.75 KB 37.46 KB 37.45 KB RN_FB_PROD
ReactNativeRenderer-dev.js -0.0% 0.0% 497.58 KB 497.44 KB 110.07 KB 110.08 KB RN_OSS_DEV
ReactNativeRenderer-prod.js -0.0% -0.0% 204.6 KB 204.57 KB 35.81 KB 35.8 KB RN_OSS_PROD
ReactFabric-dev.js -0.0% 0.0% 488.03 KB 487.89 KB 107.72 KB 107.73 KB RN_FB_DEV
ReactFabric-prod.js -0.0% -0.0% 197.1 KB 197.07 KB 34.32 KB 34.31 KB RN_FB_PROD
ReactFabric-dev.js -0.0% 0.0% 488.07 KB 487.92 KB 107.74 KB 107.75 KB RN_OSS_DEV
ReactFabric-prod.js -0.0% -0.0% 197.14 KB 197.1 KB 34.33 KB 34.32 KB RN_OSS_PROD
ReactNativeRenderer-profiling.js +1.8% +1.9% 208.02 KB 211.73 KB 36.48 KB 37.18 KB RN_OSS_PROFILING
ReactFabric-profiling.js +1.5% +2.1% 200.1 KB 203.06 KB 34.89 KB 35.62 KB RN_OSS_PROFILING
ReactNativeRenderer-profiling.js +0.9% +1.4% 218.18 KB 220.17 KB 38.11 KB 38.65 KB RN_FB_PROFILING
ReactFabric-profiling.js +1.5% +2.1% 200.06 KB 203.02 KB 34.88 KB 35.6 KB RN_FB_PROFILING

Generated by 🚫 dangerJS

@gaearon
Copy link
Collaborator

gaearon commented Aug 29, 2018

As best I can tell, it just looks like a bug.

It would still be good to figure out the exact cause if it doesn't take more than 10 minutes. For example by removing all code in ReactDOM except the import. Seeing if the result still includes the import. If it still reproes, you could create a small repro for rollup.

@bvaughn
Copy link
Contributor Author

bvaughn commented Aug 29, 2018

I already spent well over 10 minutes trying to track down the exact cause 😄

I mainly want to unblock a sync for now. Seems like we can file a repro with Rollup later?

@gaearon
Copy link
Collaborator

gaearon commented Aug 29, 2018

Sure. It's just that if we don't have the incentive we usually don't do that for many months. Since this introduces some complexity and fragility a self-imposed incentive could be helpful.

Copy link
Collaborator

@gaearon gaearon left a comment

Choose a reason for hiding this comment

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

Might be unrelated to this PR, but I think it's in scope of this follow-up.

It appears that if I build react-dom, CJS bundles include require('interaction-tracking'). Regardless of whether we strip it out with this PR, it would still be there for DEV and PROFILE bundles. But react-dom doesn't have interaction-tracking in dependencies. This means it wouldn't be installed and would fail, unless I'm missing something.

@bvaughn
Copy link
Contributor Author

bvaughn commented Aug 29, 2018

That's a good catch Dan. I have not yet added deps for interaction-tracking to package.json. I'll do that with a follow up commit here in a sec.

@bvaughn
Copy link
Contributor Author

bvaughn commented Aug 29, 2018

I scanned all build modules and confirmed that only the following files reference the interaction-tracking package:

  • react-dom.development.js / react-dom.production.min.js / react-dom.profiling.min.js
  • ReactDOM-dev.js / ReactDOM-prod.js / ReactDOM-profiling.js
  • ReactNativeRenderer-dev.js / ReactNativeRenderer-prod.js / ReactNativeRenderer-profiling.js
  • ReactFabric-dev.js / ReactFabric-prod.js / ReactFabric-profiling.js
  • react-test-renderer.development.js / react-test-renderer.production.min.js
  • ReactTestRenderer-dev.js
  • react-reconciler.development.js / react-reconciler.production.min.js / react-reconciler-persistent.development.js / react-reconciler-persistent.production.min.js

I've updated the corresponding package.json to add this dependency.

My gut tells me that the best compromise to address deduplication concerns and non-backwards-breaking release for react-dom and co is to lock the version dep for interaction-tracking to match the version of react and co. So this is what I've done. (Happy to discuss this and/or change it. I don't feel strongly.)

Since this is a new, relatively unproven package– if we release it with a > 1.0 version, I should probably also rename the exported methods with an unstable_ prefix for now.

@TrySound
Copy link
Contributor

Can't you just skip circular dependency warnings in onwarn callback? Or something is changed in rollup behaviour?

@bvaughn
Copy link
Contributor Author

bvaughn commented Aug 29, 2018

It's not a warning. It's a runtime error.

@bvaughn
Copy link
Contributor Author

bvaughn commented Aug 29, 2018

Dan and I chatted more about this out of band and realized that a new interaction-tracking dependency would also be problematic for UMD builds, because it would be a backwards breaking change for existing apps (for example, existing code pens).

So I think the best plan forward is this:

  • Release interaction-tracking as its own NPM module, since it can be used without React.
  • Expose interaction-tracking methods via a React.unstable_interactions object wrapper. Node builds will just re-export the new NPM module, but UMD builds will embed the methods.
  • Access interaction-tracking methods via React.unstable_interactions so that existing UMD builds will work.
  • Version-lock the interaction-tracking API with React, since React will be re-exporting it.

@bvaughn bvaughn force-pushed the interaction-tracking-follow-up branch from 807cdb1 to 17d0f06 Compare August 29, 2018 23:25
@bvaughn
Copy link
Contributor Author

bvaughn commented Aug 29, 2018

I just pushed the React re-export change. An added benefit was that I was able to revert the Rollup strip-unused-require hack.

@bvaughn
Copy link
Contributor Author

bvaughn commented Aug 29, 2018

We already had test cases for the interaction-tracking package when the feature flag was enabled and disabled, but I went ahead and added another test that would cover the built bundle– just to ensure that the functionality that was common across all builds (e.g. tracked functions are run, wrapped functions are run, etc.) works.

@bvaughn
Copy link
Contributor Author

bvaughn commented Aug 30, 2018

Yay! Packaging fixture is happy now too.

@sebmarkbage
Copy link
Collaborator

Why do we have to reexport it on CJS builds? I don’t care about UMD builds because they’re a shit show regardless.

But let’s minimize the damage.

@sebmarkbage
Copy link
Collaborator

sebmarkbage commented Aug 30, 2018

I think this should go on the secrets object and then we build a new script tag for interaction tracking that only re-exports the api from the React bundle.

There should be no public api for this on React even if it is temporarily packaged in it. That’s how we did it with React and ReactDOM back in the day. Everything was actually in React bundle.

Seems like that strategy worked well

@gaearon
Copy link
Collaborator

gaearon commented Aug 30, 2018

In CJS we have another concern: versioning. If you have two versions of interaction-tracking (one from react-dom/node_modules and another required by your app) they won't see each other. I figured that we already "solved" this to the best of our ability with react package (which is at least a peer) so we can fall back on it for this too.

This would only help if we encourage React users to consume tracking from the React object of course.

@sebmarkbage
Copy link
Collaborator

sebmarkbage commented Aug 30, 2018

The goal of this package, just like the react-scheduler is to make it universal and used outside React and hopefully eventually part of the platform.

It seems to me that both of these new packages need to become peer dependencies for that to happen.

@sebmarkbage
Copy link
Collaborator

Since deferredUpdates is gone, the async strategy requires access to the scheduler. Seems like we imminently need a solution that brings it out of React too.

@gaearon
Copy link
Collaborator

gaearon commented Aug 30, 2018

It seems to me that both of these new packages need to become peer dependencies for that to happen.

Yeah. But that would be a breaking change for react-dom so it's unfeasible until 17. Even there I'm skeptical about forcing React users to install extra packages for things they may not plan to use (like interaction-tracking).

The goal of this package, just like the react-scheduler is to make it universal and used outside React and hopefully eventually part of the platform.

It can still be used universally by itself if React re-exports it. But it's a migration path to that. I don't know how you plan to make it a peer now because require()ing a new non-direct-dep package is a breaking change.

react/scheduler and react/interaction-tracking is another potential compromise.

@bvaughn
Copy link
Contributor Author

bvaughn commented Aug 30, 2018

Was driving home from work so I'm just now seeing this discussion, but I agree with Dan's recent comments. Don't really have much to add.

I'm not thrilled about this, but it seemed like the best compromise given the constraints of not breaking backwards compat in a minor release.

@bvaughn
Copy link
Contributor Author

bvaughn commented Aug 30, 2018

Actually I guess I can respond to this:

Why do we have to reexport it on CJS builds? I don’t care about UMD builds because they’re a shit show regardless.

We need to access it in a consistent way from renderers. Accessing it by importing e.g. "interaction-tracking" then it would break the UMD build unless we somehow re-mapped such imports to React.unstable_interactions.

Maybe this would be possible with our Rollup forks system and some sort of shim. I could investigate it tomorrow if you feel it's worth looking into. This would result in kind of a weird combination of package.json dependencies though– both react and e.g. react-dom would need to depend on the interaction-tracking package, even though it would only be used in one bundle type.

@sebmarkbage
Copy link
Collaborator

sebmarkbage commented Aug 30, 2018

it would break the UMD build unless we somehow re-mapped such imports to React.unstable_interactions.

The secrets thing seems better but let's first figure out the CJS thing.

Even there I'm skeptical about forcing React users to install extra packages for things they may not plan to use (like interaction-tracking).

My concern is that it seems like we're trying to force this in as an intermediate step but we don't have a viable plan for how this is supposed to work in the future. So I don't understand if this intermediate step even makes that upgrade path viable.

Why does it have to be react that takes on the dependency? There's nothing in react that should depend on interaction-tracking. If we forget about UMD for a sec, is there any reason to put it in there?

What exactly is the breakage if react-dom takes on a hard dependency on interaction-tracking and we ask others to add it as a peer dep. These should dedupe anyway, no? Especially since react-dom should be a peer dep too.

If we can't solve this, this might be a good reason to just publish this as 17. The reason we don't release majors often is because of the breaking changes inside of them are a pain to upgrade. Not because releasing majors by its own is a bad thing.

@gaearon
Copy link
Collaborator

gaearon commented Aug 30, 2018

I’ve never thought about making something both a dep and a peer. That could work. It’s still going to generate backlash though. React is already one too many packages. Every tutorial saying yarn add react react-dom would now produce a warning.

Maybe I’d be more open to this with a different name than interaction-tracking. I just don’t think a knee jerk reaction to adding something called like this to a project when I don’t know what it is would be good.

Brian Vaughn added 4 commits September 1, 2018 08:01
React UMD bundles inlines the new react-scheduler package and exposes the API via the SECRET_INTERNALS object. UMD bundles of e.g. ReactDOM access the API this way. This avoids breaking backwards compat for UMD bundles (since it avoids requiring a new <script> tag).

react CJS bundles to not inline the react-scheduler package. Instead, react-dom and other renderers import the shared NPM module. A hard NPM depedency has been added to react-dom and other renderers on the new react-scheduler package so that upgrades will not require any additional npm-install steps.

A UMD bundle of the new react-scheduler also exists which defines the same public API but lazily forwards method calls to the React SECRET_INTERNALS inlined version. This allows the new API to be used in e.g. Code Pens if people want to.
@bvaughn bvaughn force-pushed the interaction-tracking-follow-up branch from c8d5899 to c5b4db2 Compare September 1, 2018 15:03
@gaearon
Copy link
Collaborator

gaearon commented Sep 1, 2018

It does save a little bit on bundle size, but more importantly I think, it removes a lot of iteration and error-catching complexity from the main tracking module in the (most likely) event that you aren't using subscriptions.

If the concern is in implementation complexity why not keep them as separate files but re-export from both in a single entry point? Conceptually they’re related.

@bvaughn
Copy link
Contributor Author

bvaughn commented Sep 1, 2018

Looks ok to me overall. Let’s make sure React + ReactDOM size has not increased for any type of production bundle.

React production bundle did get a little bigger (+24KB). Looking at a diff, it seems like it's caused by a new invariant related to unstable_read (so not this PR).

@bvaughn
Copy link
Contributor Author

bvaughn commented Sep 1, 2018

My latest commit was just a change to an inline comment, so it shouldn't fail CI. 😄

Looks like a Yarn registry issue:

error An unexpected error occurred: "https://registry.yarnpkg.com/art/-/art-0.10.1.tgz: getaddrinfo ENOTFOUND registry.yarnpkg.com registry.yarnpkg.com:443".

@bvaughn
Copy link
Contributor Author

bvaughn commented Sep 1, 2018

If the concern is in implementation complexity why not keep them as separate files but re-export from both in a single entry point? Conceptually they’re related.

I am not opposed to that. 😄

@gaearon
Copy link
Collaborator

gaearon commented Sep 1, 2018

Wanna unify then? Seems like this would simplify the bundling setup and UMDs.

@bvaughn
Copy link
Contributor Author

bvaughn commented Sep 1, 2018

Wanna unify then? Seems like this would simplify the bundling setup and UMDs.

I'm trying this locally now. If it's not too churny, I'll push it here. Else I might do it via a follow up.

@bvaughn
Copy link
Contributor Author

bvaughn commented Sep 1, 2018

As things are currently written, this would have a bit of an impact. During initialization, the subscriptions module registers itself as a subscriber with the tracking module's subscriberRef.current so that it can work. This will cause tracking module to call a bunch of subscriber functions even if nothing is using them.

I think this is avoidable though by just delaying registration until the first time a subscriber is added. I'll make this change and add a test.

@bvaughn
Copy link
Contributor Author

bvaughn commented Sep 1, 2018

Looks like it turned out to just simplify a bunch of small things 😄 So done~

@bvaughn
Copy link
Contributor Author

bvaughn commented Sep 1, 2018

Local testing/fixtures look good. My test app seems happy. Hand inspected the bundles and they look good. Assuming CI is happy– I'm going to land this and we can iterate on it more on Monday if anything else pops up. 😄 I'm feeling good about these changes though!

@bvaughn
Copy link
Contributor Author

bvaughn commented Sep 1, 2018

CI failure is due to Yarn registry again. Restarting...

}

return Object.freeze({
__getInteractionsRef: __getInteractionsRef,
Copy link
Collaborator

Choose a reason for hiding this comment

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

It would be nice to have some automatic check that verifies the list of exports matches the list of commonjs exports 1:1

Copy link
Collaborator

Choose a reason for hiding this comment

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

(I understand you added a fixture but someone could add a method to CJS API, and forget to test it in fixture)

Copy link
Contributor Author

@bvaughn bvaughn Sep 1, 2018

Choose a reason for hiding this comment

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

Yeah, that's reasonable. Although I think the bundled UMD solution is pretty reasonable– and it's really only for edge-case usage anyway– I'm not very happy with these "shims" and the way they kind of bypass our normal build system.

I'm not sure how to add an automated check without increasing the hackiness. Any ideas?

Copy link
Collaborator

Choose a reason for hiding this comment

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

A node script that imports all bundles after build and verifies their exports match up.

Or a Jest test if you can figure out a way to import the entry point shim.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Whoops, this comment just came through. I'll tackle this with a follow up :)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Huh. That turned out to be simpler than I thought. 😄

#13532

@bvaughn
Copy link
Contributor Author

bvaughn commented Sep 1, 2018

I've run all of the CI scripts/checks locally, so I'm going to go ahead and land this without waiting for the Yarn registry issue to be resolved.

@bvaughn bvaughn merged commit 46950a3 into facebook:master Sep 1, 2018
@bvaughn bvaughn deleted the interaction-tracking-follow-up branch September 1, 2018 19:00
jetoneza pushed a commit to jetoneza/react that referenced this pull request Jan 23, 2019
* Merged interaction-tracking package into react-scheduler
* Add tracking API to FB+www builds
* Added Rollup plugin to strip no-side-effect imports from Rollup bundles
* Re-bundle tracking and scheduling APIs on SECRET_INTERNALS object for UMD build (and provide lazy forwarding methods)
* Added some additional tests and fixtures
* Fixed broken UMD fixture in master (facebook#13512)
NMinhNguyen referenced this pull request in enzymejs/react-shallow-renderer Jan 29, 2020
* Merged interaction-tracking package into react-scheduler
* Add tracking API to FB+www builds
* Added Rollup plugin to strip no-side-effect imports from Rollup bundles
* Re-bundle tracking and scheduling APIs on SECRET_INTERNALS object for UMD build (and provide lazy forwarding methods)
* Added some additional tests and fixtures
* Fixed broken UMD fixture in master (#13512)
markerikson added a commit to replayio/react that referenced this pull request Mar 20, 2023
This was added as part of the "Interaction Tracking" work in facebook#13509
back in 2018. That feature was removed in facebook#20037 in 2020, and this
plugin appears to no longer have any effect on the build output.
markerikson added a commit to replayio/react that referenced this pull request Mar 20, 2023
This was added as part of the "Interaction Tracking" work in facebook#13509
back in 2018. That feature was removed in facebook#20037 in 2020, and this
plugin appears to no longer have any effect on the build output.
markerikson added a commit to replayio/react that referenced this pull request Mar 20, 2023
This was added as part of the "Interaction Tracking" work in facebook#13509
back in 2018. That feature was removed in facebook#20037 in 2020, and this
plugin appears to no longer have any effect on the build output.
markerikson added a commit to replayio/react that referenced this pull request Mar 20, 2023
This was added as part of the "Interaction Tracking" work in facebook#13509
back in 2018. That feature was removed in facebook#20037 in 2020, and this
plugin appears to no longer have any effect on the build output.
markerikson added a commit to replayio/react that referenced this pull request Mar 20, 2023
This was added as part of the "Interaction Tracking" work in facebook#13509
back in 2018. That feature was removed in facebook#20037 in 2020, and this
plugin appears to no longer have any effect on the build output.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Node/UMD bundles are broken on master
6 participants