Skip to content

Extern only packages

Juho Teperi edited this page Apr 28, 2016 · 1 revision

Some packages only include the extern files. These packages don't provide any foreign lib namespaces and don't need to be required. The extern file is always used by Closure compiler when the dependency is provided.

One needs to provide the code using some other mechanism. Best solution is to use the method recommended by the vendor. Usually you need to include a <script> tag in your html.

Reasons

In some cases it is not possible or good idea to include the JavaScript code in the package. Such cases are for example Google Maps, Google Platform.js and Stripe.js. In these cases the vendor presumes that you use the code directly from their server and might update the code often to fix bugs.

It would be possible to package the code into Cljsjs package and version it using e.g. date. But this would mean that applications that depend on the Cljsjs package will continue using the selected version until the application is updated. This might mean that the application is vulnerable to some fixed security issue for a long time. It is also possible that vendor updates the network APIs used by code so that the old version no longer works.

Stripe

Note: Stripe.js should be loaded directly from https://js.stripe.com/v2/.

Source: https://stripe.com/docs/stripe.js