Conversation
🦋 Changeset detectedLatest commit: ad57eb7 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
|
@cristiano-belloni Looks good! Can we create a changeset for each of the fixes? Then we can merge this! |
Three changesets created, one per broad topic. |
| global: 'window', | ||
| }, | ||
| banner: { | ||
| js: `window.process = { |
There was a problem hiding this comment.
This probably needs a todo, web pack actually shims the process variable / other node.js concepts which is how they're defined. This is probably fine thought.
There was a problem hiding this comment.
Yeah, that's the minimum viable injection to make react-error-overlay work.
There's a shim for it, yes (it even mocks complex stuff stuff like hrtime via the browser's timers) but our main problem with the newest version of reo is that the iframe tries to access process, and it's not trivial to inject it there.
| publish(); | ||
| }); | ||
| const publishAll = () => { | ||
| // eslint-disable-next-line @typescript-eslint/no-misused-promises |
There was a problem hiding this comment.
Is there a way to resolve these lint warnings neatly?
There was a problem hiding this comment.
Maybe
return Promise.all(server.clients.map(publishClient));There was a problem hiding this comment.
That and a bunch of void typings did the trick.
Various fixes, in preparation to #1382
Fix reload when serving an esbuild app / view
Various problems:
isFirstCompilationcondition prevented the apps from reloading on change, fixed order.watching the build correctly, but not using the new build result anywhere. As a result, the browser tab would reload, but not show new content. Fixed by setting the new result with the build callback.Call
formatErrorwith the correct pathIn esbuild-world, errors passed to
formatErrorare relative to ModularRoot. If we pass them relative to the app path, instead,formatErrortries to open a wrong path and kills the server with an exception. This fixes it.Stop Esbuild dev server from hanging
Sometimes the esbuild dev server hangs indefinitely when it's killed, either from terminal or programatically during tests. To solve the first issue,it seems it's sufficient to terminate its clients one by one. To solve the second issue, I'm sending a
kill -9programatically.Revert react-error-overlay to previous patch and inject
process.envandprocess.platformIt seems that in the latest patch, react-error-overlay is not only trying to access
process, but the code it loads in the iframe it creates does too. In both cases, ifprocessis not defined, react-error-overlay throws and is not available at runtime. For the first issue, the solution is to just injectprocessin the runtime. For the second issue, it's not clear how CRA does that (maybe at build time with a shim? I don't think they use the packaged react-error-overlay). Since this issue has been probably introduced by an automatic update, the solution is to inject process to solve issue 1 and revert to the previous patch to solve issue 2.