rnx-kit
rnx-kit copied to clipboard
Develop a bundle-splitting engineering plan
Develop a detailed engineering plan for bundle-splitting.
Use the bundle-splitting scenarios from #1282 as a starting point, along with code from internal Office repos. Cover both bundle production and bundle consumption. Include expectations regarding bundle size increase compared to equivalent single-bundle runs.
Output is a plan and a task list.
Notes on one possible solution
A split bundle exports a collection of packages, each under a unique name. The split bundle author specifies this mapping as kit configuration.
For example, it might look like this:
"rnx-kit": {
"splitBundle": {
"interface": {
"MyKitGlobal.Telemetry": "telemetryjs",
"MyKitGlobal.StringResources": "string-resources",
"MyKitGlobal.ReactNative.Components": "react-native"
}
}
}
The bundler will take this configuration, and use it to generate a programmatically-consumable, type-safe API. Something along the lines of a typescript .d.ts file.
Other packages which depend on this kit will naturally gain access to the type-safe API, and benefit from it in IDEs like VSCode and at lint/build time.