RJS-2732: Support updating the App's base URL via experimental export#6518
RJS-2732: Support updating the App's base URL via experimental export#6518
App's base URL via experimental export#6518Conversation
realm/experimentalApp's base URL via experimental export
nirinchev
left a comment
There was a problem hiding this comment.
Nice! Might be worth adding a smoke test that updating the base url to a valid url also works. We could try and use realm.mongodb.com since that domain should still work.
|
Just reviving the old draft implementation then I'll be modifying the test and adding some more 🙂 |
| it.skip("updates the URL", async function (this: AppContext) { | ||
| // TODO | ||
| }); |
There was a problem hiding this comment.
Will add this using a fetch mock.
integration-tests/environments/react-native-test-app/metro.config.js
Outdated
Show resolved
Hide resolved
| "target": "es2022", | ||
| "module": "es2022", | ||
| "moduleResolution": "node", | ||
| "moduleResolution": "Bundler", |
There was a problem hiding this comment.
Did you check this works with npm test --workspace @realm/integration-tests (where we use raw Mocha and tsx to transpile TypeScript)?
|
|
||
| // This file is needed as a workaround for Metro unexpectedly failing | ||
| // to use the entry point defined in the package.json `exports` field, | ||
| // despite enabling `unstable_enablePackageExports`. |
There was a problem hiding this comment.
Well - even if this wasn't a problem, we would probably need this file anyway, to workaround the fact that unstable_enablePackageExports is disabled by default 🤔
There was a problem hiding this comment.
Also ... I know for a fact that the Metro team would be very grateful if someone would set up some tests of the metro resolver (most likely copying in tests from other packages / tools). This would make a good test case if the pattern isn't already covered by one of those other tests.
There was a problem hiding this comment.
I've updated the comment to incorporate being disabled by default. Feel free to suggest any additional changes you think would be relevant for this file 👍
I'd be glad to look over some of the Metro tests and see what could be added. At first glance, it does seem like their tests are covering subpath exports.
| - React-jsi | ||
| - ReactTestApp-Resources (1.0.0-dev) | ||
| - RealmJS (12.7.0-rc.0): | ||
| - RealmJS (12.7.1): |
There was a problem hiding this comment.
I wonder why this was not already on main 🤔
There was a problem hiding this comment.
Probably just didn't get committed 🤷♀️
Co-authored-by: Kræn Hansen <kraen.hansen@mongodb.com>
|
@kneth, for the final review there are only minor changes to look at:
Still missing:
|
What, How & Why?
Experimental exports/imports
experimentaldirectory has been added (packages/realm/src/experimental), intended for exporting various experimental features.Base URL
"realm/experimental/base-url"will extend theAppwith the instance membersApp.baseUrlandApp.updateBaseUrl(), allowing the user to retrieve and update the base URL.TSConfig / Choosing module resolution
tsconfig.json:{ "compilerOptions": { "target": "es2022", "module": "node16", "moduleResolution": "node16", // ... } }Example Usage
This closes #6486
☑️ ToDos