Friday, 26 May 2017

React: Good Practices For CDNs, Node_Modules and Both

Been building a React application on top of create-react-app which uses Webpack through react-scripts and has React/Redux/React-dom, etc. as dependencies in our package.json.

To use those JS dependencies, we use import statements, however, for other JS dependencies (i.e. the JS used in Bootstrap and jQuery), we import those through CDN. (We have the Bootstrap CSS files in our CSS directory, and use import statements).

Is there a generally accepted practice to use CDNs vs node_modules or both on the front-end side?

My initial thought was to use CDNs to get static JS files if you're not going to use them as imports in your JS files, but wondered if that was the right way to think about it.

Obviously this isn't a React specific question, just using React to give more context.



via devonJS

No comments:

Post a Comment