Closed flexbox closed 1 year ago
@flexbox Did you get anywhere with figuring out how to fix this or measure bundle size for react native apps on NX in the end? Currently hitting same issue as you are
Hey @MikeSpitz Unfortunately no, I tried for a day a gave up on this.
I will close for now because it seems out of scope and monorepo with Nx is a very different world Vs "classic" apps.
@flexbox @MikeSpitz
I have a trick to support Nx.
Firstly, configure your project.json to output the sourcemap as follow. https://nx.dev/packages/react-native/executors/bundle#examples
Then you can see both main.jsbundle and main.map inside dist/apps/<your_app>/ios
or dist/apps/<your_app>/android
Update the last line in main.jsbundle
to main.map
instead of the relative path
to
Then install https://github.com/danvk/source-map-explorer
Then run yarn source-map-explorer dist/apps/<app>/<platform>/main.jsbundle
Since source-map-explorer
cannot specify the sourcemap path, so I have to manually update it in main.jsbundle
If I won't do this, source-map-explorer
will resolve the path into like ...dist/apps/dist/apps...
, duplicating the dist/apps
, I suspect it is due to the ../../
relative path set during executing @nrwl/react-native:bundle. But we have to do that to put the main.map besides main.jsbundle.
Let me know if you guys got tricks to skip the manual part.
https://github.com/nrwl/nx/blob/master/packages/react-native/src/executors/bundle/schema.json
there is the sourcemapSourcesRoot
to configure... not yet got time to try out. @flexbox
Thank you for the feedback @keithchan-bowtie Maybe we can try to "half-automate" the process with patch-package. If I land on a solution I will post an update here 😀
Hey Thank you for this cool library!
I had a look at #74 and I think I am running in —more or less— the same issue.
My stack is a React Native Library, created with Nx Here is an example https://github.com/flexbox/react-native-nx-monorepo
Does anyone know how to make it run with NX? ?