简体   繁体   中英

Why bundle a React server.js for Node?

In the React Starter Kit they bundle with Webpack the server-side code into a server.js which I assumed can be handy but then I started wondering why bundling up the server-side code in the first place, after all Node comes with its own dependency management and doesn't need that. Second, wouldn't that even make it more inefficient due to parsing one whole file?

React code usually got written in ES6 however the Node doesn't support the es6 code yet, it can only understand es5. so if you want to use it without bundling and all the code will get complied first on the go. which will affect the performance eventually so you can use it for the development purpose but in production it is advised to use the bundled code.

So the major reason is Performance

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM