I was watching the Pluralsight course on TypeScript and they were talking about using requirejs to load libraries from 3rd parties (jQuery) with AMD. However, the way shown looked like it ALWAYS pulled in the library with a shim:{} I’m curious if there is a way to pull this in only if it’s not present?
Or does shim take this into account?
If you are using
requirejsand ask for the same module multiple times, it is clever enough to give you the same one.It does this using a cache of modules.
If the path to the module is different, it will load it a second time (i.e. the same resource with different relative paths because it is being consumed from different levels of sub-folders, for example).