Hello. I would like to use CDN for 3party libraries which is not common library stuff. It is currently in vendor folder and use it globally. but I want to make it exclude from vendor and get them from private server since its size is so big and no need for version management.
What do you say to do that? Is it fine with ember? and I wonder how to deal with that if there is someone like me.
seems like that putting every libraries in vendor and reference them is common for ember. right?
ember-cli : 3.0
Did you checked out the Fingerprinting and CDN URLs part of ember-cli docs? Another even more advanced approach is dynamic import of dependencies which are only needed for parts of your application. It’s supported by latest releases of ember-auto-import.
It’s OK to choose to not bundle a library and instead load it directly from CDN. You can do it without anything Ember-specific. Just put the <script> tag into index.html pointing at the hosted version and you’re done.
Only caveat with loading libraries from CDN is that you may be loading more JS (or CSS) than you need to since you cannot customize the build (I know, most people don’t customize the build anyways, ).
Take LoDash as an example, you may only use a handful of utility functions from that, but if you pull the library from a CDN you pull down all of the utility functions.
That might still be more performant, but the only way to really know is to test it. And make sure to include mobile devices in testing, because they will struggle more with larger JS files than computers do.