You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@stoyan The only dependencies that all create-react-app apps share is react and react-dom, is that what you mean?
@HatemJerbi The benefit would be small I think? Often changing your app code will use more/less of the library code, which will mean that the uglified version of your 'node_modules' bundle will be different.
@tbillington yeah, I guess so. I just created a test app, deleted everything except index.js and built. The result is 160K (46K after gzip) of stuff. So ideally this can be shared between all apps, it's independent of the application code.
Question: When does create-react-app pull the current version of react+reactdom? When you generate a new app or when you install/update create-react-app?
@stoyan you could do something like eject (or modify the internal of react-scripts) to tell webpack to assume react is provided by the environment, then link to react on a cdn in your html.
That way your app will not bundle react which will greatly reduce the size, and you get cdn benefits. The 160kb base blob you mentioned is essentially just react and webpack module wrapping + some polyfill as far as I know..
Activity
HatemJerbi commentedon Sep 2, 2016
it will be nice if the build generate one hashed vendor bundle (modules imported from node_modules) and one app hashed bundle.
tbillington commentedon Sep 2, 2016
@stoyan The only dependencies that all
create-react-app
apps share is react and react-dom, is that what you mean?@HatemJerbi The benefit would be small I think? Often changing your app code will use more/less of the library code, which will mean that the uglified version of your 'node_modules' bundle will be different.
stoyan commentedon Sep 2, 2016
@tbillington yeah, I guess so. I just created a test app, deleted everything except index.js and built. The result is 160K (46K after gzip) of stuff. So ideally this can be shared between all apps, it's independent of the application code.
Question: When does
create-react-app
pull the current version of react+reactdom? When you generate a new app or when you install/updatecreate-react-app
?tbillington commentedon Sep 2, 2016
@stoyan It gets react+dom when you generate a new app.
tbillington commentedon Sep 2, 2016
@stoyan you could do something like eject (or modify the internal of react-scripts) to tell webpack to assume react is provided by the environment, then link to react on a cdn in your html.
That way your app will not bundle react which will greatly reduce the size, and you get cdn benefits. The 160kb base blob you mentioned is essentially just react and webpack module wrapping + some polyfill as far as I know..
gaearon commentedon Sep 2, 2016
We tried this before in #210 and found some issues with Webpack. I want to revisit this after Webpack 2 is declared stable and we switch to using it.