Rob Hogan's Avatar

Rob Hogan

@robhogan.dev.bsky.social

React Native @ Meta

557 Followers  |  194 Following  |  24 Posts  |  Joined: 15.07.2023  |  2.1624

Latest posts by robhogan.dev on Bluesky

Indeed - I’m not fully sure what it would even mean for a bundler to natively support ESM, or CJS for that matter. There are no ESM bundles (yet)

Bundlers don’t implement module systems, they create scripts that emulate them. All any bundler does is reduce graphs. How is just implementation detail.

16.12.2024 21:08 β€” πŸ‘ 4    πŸ” 0    πŸ’¬ 0    πŸ“Œ 0

(*experimentalImportSupport was designed for runtime perf in opinionated codebases, and doesn’t yet support circular dependencies or `export let`)

16.12.2024 20:30 β€” πŸ‘ 2    πŸ” 0    πŸ’¬ 0    πŸ“Œ 0

Yep. Although neither is really β€œnative” (that’s on the engine), both are just Babel transforms.

The difference is mostly that in the latter case Metro can tell the difference between imports and requires, for things like Expo tree shaking, conditional resolution, and inlining.

16.12.2024 20:27 β€” πŸ‘ 4    πŸ” 0    πŸ’¬ 1    πŸ“Œ 0

As a tooling guy I have a lot of sympathy for this - even in Metro, Flow was a pain point in SWC experiments.

But DX for us is about users building apps. Ease of bring-your-own-toolchain isn’t a DX goal.

If you use a framework it’s a non-issue, if you author a framework, build on the common core.

16.12.2024 16:05 β€” πŸ‘ 2    πŸ” 0    πŸ’¬ 1    πŸ“Œ 0

The other possibility is something like JS0, essentially a communicable, specced intermediate.

The problem with the status quo is we talk about pre-compilation with no agreed target (Node LTS, browserslist, ES5?). Most pre-compiled node_modules wouldn’t run in Hermes, so we have to compile again.

16.12.2024 15:50 β€” πŸ‘ 2    πŸ” 0    πŸ’¬ 1    πŸ“Œ 0

Yeah, I think we’re probably just talking about different time horizons, ultimately I expect precompilation to go away because I think it’s been a crutch we ideally wouldn’t need, but I don’t think it’ll be soon - just signs we’re moving that way.

16.12.2024 15:44 β€” πŸ‘ 2    πŸ” 0    πŸ’¬ 1    πŸ“Œ 0

It matters if the pre-compilation loses information or adds cruft, which it generally does.

Besides bundles being smaller and faster, publishing source is easier, and it’s more hackable and debug friendly.

With Bun+Node supporting TS directly and web still build reliant, we might see more of it.

16.12.2024 02:18 β€” πŸ‘ 3    πŸ” 0    πŸ’¬ 1    πŸ“Œ 0

Libraries shipping Flow/TS source might turn out to be well-placed for Static Hermes.

In general, there are good arguments for preserving information. Pre-compiled is rarely optimally compiled. It’s just not the way the ecosystem has gone.

16.12.2024 01:47 β€” πŸ‘ 6    πŸ” 0    πŸ’¬ 1    πŸ“Œ 0
Preview
"show source" is not always respected under lazy compilation Β· Issue #1583 Β· facebook/hermes Bug Description Lazy compilation does not respect "show source", so [function].toString() fails to provide useful output. This is observable under React Native, typically when loading a bundle in d...

github.com/facebook/her...

15.12.2024 21:52 β€” πŸ‘ 6    πŸ” 0    πŸ’¬ 0    πŸ“Œ 0

Yep, especially because β€œhide source” and β€œsensitive” are a thing.

(..which are also not respected in lazy comp, but the difference is pretty superficial - `[bytecode]` instead of `[native code]`)

15.12.2024 21:49 β€” πŸ‘ 3    πŸ” 0    πŸ’¬ 0    πŸ“Œ 0

Before compilation would make sense as an explanation, but even invoking the function before calling its toString doesn’t help. I suspect Hermes is looking in the wrong place (original AST?) for the directive.

Tzvetan’s confirmed it’s a Hermes bug and Static Hermes works, though.

15.12.2024 21:44 β€” πŸ‘ 5    πŸ” 0    πŸ’¬ 1    πŸ“Œ 0

Ok, sniped πŸ˜…! This turns out to be because `show source` doesn’t work under lazy Hermes compilation if the input is >64KB, the preemptive compile threshold (hence appearing to work under Fast Refresh but not initial load).

Following up with Hermes as to whether that’s expected or a bug…

15.12.2024 13:28 β€” πŸ‘ 4    πŸ” 0    πŸ’¬ 2    πŸ“Œ 0

Would love to improve things here - what kind of errors do you run into? Cross web/mobile or between native platforms?

08.12.2024 23:02 β€” πŸ‘ 2    πŸ” 0    πŸ’¬ 1    πŸ“Œ 0

RN receives and accepts more community contributions than React/GQL, partly because it’s a bigger surface, but it has a lively community.

DevTools though was built in the open by a dedicated team at Meta over many months. That was the only way we were going to ship the ground-up rewrite it needed.

07.12.2024 17:04 β€” πŸ‘ 3    πŸ” 0    πŸ’¬ 1    πŸ“Œ 0

React Native 0.77 is stabilising with the second RC out yesterday. Do give it a try, let us know how you get on! github.com/facebook/rea...

05.12.2024 08:58 β€” πŸ‘ 23    πŸ” 3    πŸ’¬ 0    πŸ“Œ 0

That’s basically how I was taught it. It’s the empty product. Multiplying no things gets you the multiplicative identity, same as summing no things = additive identity.

23.11.2024 08:12 β€” πŸ‘ 2    πŸ” 0    πŸ’¬ 1    πŸ“Œ 0

Sometimes the best engineering happens when you’re just tinkering, free from expectations and deadlines.

10.11.2024 09:35 β€” πŸ‘ 363    πŸ” 51    πŸ’¬ 19    πŸ“Œ 12

Remember when phones looked like the phone icon?

09.11.2024 17:16 β€” πŸ‘ 2    πŸ” 0    πŸ’¬ 0    πŸ“Œ 0

Maybe tweak that - choose labels based on the distinctions you need to make - eg if you have some expensive tests that only run nightly, label them accordingly.

If you don’t need to distinguish, just call them all β€œtests”.

09.11.2024 16:59 β€” πŸ‘ 1    πŸ” 0    πŸ’¬ 0    πŸ“Œ 0

Event-source everything!

09.11.2024 16:49 β€” πŸ‘ 0    πŸ” 0    πŸ’¬ 0    πŸ“Œ 0

That’s a shortcoming of the testing framework IMO - they’re not true e2e tests if they depend on details your user doesn’t act on/observe.

If you had an AI testing framework that let you write β€œtap the most obvious button” -> β€œsee confirmation page” you’d be a lot closer to e2e for human UIs.

09.11.2024 16:32 β€” πŸ‘ 3    πŸ” 0    πŸ’¬ 0    πŸ“Œ 0

The distinctions can be meaningful - for example any change that breaks an e2e test is by definition semver major.

09.11.2024 16:19 β€” πŸ‘ 3    πŸ” 0    πŸ’¬ 1    πŸ“Œ 0

Eg: testing a React component may be a unit test if you’re writing an app, but an e2e test of the react library itself.

09.11.2024 16:11 β€” πŸ‘ 3    πŸ” 0    πŸ’¬ 1    πŸ“Œ 0

IMO: Unit tests test an indivisible piece of the software under test.

An integration test is any test that isn’t a unit test.

e2e tests are the subset of integration tests that deal with user input to user-observable output/effect.

All relative to where the boundaries of your software are.

09.11.2024 16:09 β€” πŸ‘ 10    πŸ” 0    πŸ’¬ 2    πŸ“Œ 0

I hear this is where tech twitter went

06.11.2024 15:15 β€” πŸ‘ 9    πŸ” 1    πŸ’¬ 0    πŸ“Œ 0
Post image

The new React Native DevTools are wild.

No additional tools are required to drill down into your components like this.

WOW πŸ”₯

05.11.2024 08:12 β€” πŸ‘ 40    πŸ” 7    πŸ’¬ 7    πŸ“Œ 0

bsky is the best react native app I’ve ever seen

04.11.2024 16:36 β€” πŸ‘ 273    πŸ” 6    πŸ’¬ 26    πŸ“Œ 2

Hi folks! πŸ‘‹

βš›οΈπŸš‡πŸ¦‹

02.11.2024 09:47 β€” πŸ‘ 25    πŸ” 0    πŸ’¬ 2    πŸ“Œ 0

@robhogan.dev is following 20 prominent accounts