mjohnston / react-native-webpack-server

Build React Native apps with Webpack
MIT License
933 stars 84 forks source link

some suggestions #154

Open changfuguo opened 8 years ago

changfuguo commented 8 years ago

@mjohnston hi , tkank you for the great work~

here i just give some suggestions:

1) when start rnws first time , we can write the ( from package.json) externals of current rn into a file ,the second time to start rnws, we check the externals 's file for the current version of rn, if exists ,just require the file ,if not exists ,just do like the first ,so we can improve the load speed

2) we can just use _entry as static files

ghost commented 8 years ago

Thanks for the suggestion @changfuguo. Given #143 performance enhancements would best serve the community behind any breaking changes discovered as the RN versions roll forward. Would you mind closing this and, if you find the time, submit a PR with the enhancements suggested once they are tested? I'm happy to help test once a PR is submitted, if you feel this is important.

philikon commented 8 years ago

Thanks for these suggestions.

(1) Mapping React Native's Haste modules to externals is really only necessary if you're writing "naughty" code that directly imports Haste modules (e.g. require('StyleSheet')) rather than accessing the APIs from the react-native module (e.g. `require('react-native').StyleSheet). So for properly written React Native apps, compiling this Haste module dependency map at startup is entirely unnecessary. That's why I made it optional in #155. I just need to release this in a version.

Moreover, we can indeed cache the entire React Native bundle and save bringing up the React Native packager entirely when we have a cached bundle present. I have a prototype working in https://github.com/philikon/react-native-webpack-server/commit/e360bf82d291985a0d8160cc4cfee0d1836dd614. There were some minor issues with it, but I can't remember what they were.

(2) I don't quite understand what this means.