History log of /expo/packages/@expo/cli/src/start/server/middleware/HistoryFallbackMiddleware.ts (Results 1 – 3 of 3)
Revision Date Author Comments
# c799f270 30-Jun-2023 Kudo Chien <[email protected]>

[cli] fix js inspector is broken when using web SSG (#23197)

# Why

when web SSG is enabled, pressing `j` to open js inspector is broken:
```
Opening JavaScript inspector in the browser...
Web

[cli] fix js inspector is broken when using web SSG (#23197)

# Why

when web SSG is enabled, pressing `j` to open js inspector is broken:
```
Opening JavaScript inspector in the browser...
Web Bundling complete 4499ms
Web Bundling complete 4524ms
FetchError: invalid json response body at http://192.168.50.38:8081/json/list reason: Unexpected token < in JSON at position 0
FetchError: invalid json response body at http://192.168.50.38:8081/json/list reason: Unexpected token < in JSON at position 0
```

# How

originally we have #21068 fix for the HistoryFallbackMiddleware. the new middleware for SSG unfortunately does not have the fix.
i feel like the root cause is coming from middleware disorder. digging the code in deep, i found we've chained the `connect` app. the `middleware` returned from `Metro.createConnectMiddleware` is actually a connect app, because rn-cli will set the `enhanceMiddleware` and it creates the `connect` app under the hood.

this pr tries to reuse the connect app. without the connect app chaining, those web middlewares will be placed after the inspector proxy middleware.

also removed the #21068 hack for HistoryFallbackMiddleware in this pr.


# Test Plan

```
$ yarn create expo -t tabs@sdk-49 sdk49tabs
$ cd sdk49tabs
$ npx expo start
# press `j`
```

after the fix, i've checked:
1. press `j`
2. check `http://localhost:8081/json/list` returns an array
3. check `http://localhost:8081/helloweb` returns a html content
4. disable SSG (the `"output": "static"` in **app.json**), check `http://localhost:8081/helloweb` returns a html content

show more ...


# 7a619cc1 09-Feb-2023 Evan Bacon <[email protected]>

feat: support Hermes debugger on native when Metro web is running. (#21068)

# Why

Hermes debugger doesn't work when Metro web is enabled because the
endpoints are being intercepted by the histor

feat: support Hermes debugger on native when Metro web is running. (#21068)

# Why

Hermes debugger doesn't work when Metro web is enabled because the
endpoints are being intercepted by the history fallback middleware.


<!--
Please describe the motivation for this PR, and link to relevant GitHub
issues, forums posts, or feature requests.
-->

# How

- Detect inspector proxy requests and skip returning the index.html.
- Add better error handling for Apple script failing to launch Chrome
(which can sometimes happen when using chrome for web).

<!--
How did you build this feature or fix this bug and why?
-->

# Test Plan

- Added tests for endpoint logic
- `npx create-react-native-app -t with-router` `expo.jsEngine: hermes`
-> open ios -> press `j` -> doesn't fail.

<!--
Please describe how you tested this change and how a reviewer could
reproduce your test, especially if this PR does not include automated
tests! If possible, please also provide terminal output and/or
screenshots demonstrating your test/reproduction.
-->

# Checklist

<!--
Please check the appropriate items below if they apply to your diff.
This is required for changes to Expo modules.
-->

- [ ] Documentation is up to date to reflect these changes (eg:
https://docs.expo.dev and README.md).
- [ ] Conforms with the [Documentation Writing Style
Guide](https://github.com/expo/expo/blob/main/guides/Expo%20Documentation%20Writing%20Style%20Guide.md)
- [ ] This diff will work correctly for `expo prebuild` & EAS Build (eg:
updated a module plugin).

---------

Co-authored-by: Expo Bot <[email protected]>

show more ...


# 6d6b81f9 23-Jun-2022 Evan Bacon <[email protected]>

feat(cli): add web support to metro (#17927)

* feat: add web support for metro

* undo patch

* Update index.js

* Update MetroBundlerDevServer.ts

* Add second bundler dev server

* Add d

feat(cli): add web support to metro (#17927)

* feat: add web support for metro

* undo patch

* Update index.js

* Update MetroBundlerDevServer.ts

* Add second bundler dev server

* Add dev loading view to web

* Put feature behind EXPO_USE_METRO_WEB flag

* Move custom config into CLI

* Add support for assets across platforms

* reduce

* Added upstream web support

* Update webTemplate.ts

* Update CHANGELOG.md

* Update instantiateMetro.ts

* Update instantiateMetro.ts

* Update index.js

* Added bundle splitting support

* Update startAsync.ts

* Fixed default settings

* Add ability to copy from public folder

* wip: redirect unmatched routes to `/` on web

* fix fallback api

* Update exportApp.ts

* Update instantiateMetro.ts

* Update exportApp.ts

* clean up handler

* fixup

* clean up

* add web to export test

* Update start-test.ts

* added static serving for web

* Update packages/@expo/cli/CHANGELOG.md

Co-authored-by: Expo Bot <[email protected]>

* Update yarn.lock

lint fix

fix tests

* Update export-test.ts

* added template tests

* Create HistoryFallbackMiddleware-test.ts

* test ManifestMiddleware

* Create ServeStaticMiddleware-test.ts

* refactor multiplatform

* Update ManifestMiddleware-test.ts

* Update withMetroMultiPlatform.ts

* Update for latest metro

* Update packages/@expo/cli/src/export/resolveOptions.ts

Co-authored-by: Expo Bot <[email protected]>

show more ...