With the SDK for the Web, you have two options for how the end customer gets the library.
- You can download the file from the npm registry, and serve this file from your servers.
- You can serve the file via CDN. JSdeliver and unpkg are two services that serve all npm packages, including Scandit's.
With each approach, there are tradeoffs.
Serving the file yourself means that you have full control over the availability of the library. Additionally, most CDN services do not offer compression. Depending on where you self-host things it may be faster because the browser requests the assets from the same server instead of self-hosted-website server + CDN server separately.
Serving the file via CDN allows you to either incorporate the latest library or to specify a version. We recommend always specifying a version of the library, which means that your application won't be impacted by any changes we make (especially breaking changes).
For quick experiments or small demos, using a CDN is perfectly fine and very convenient. However, for production use we strongly recommend self‑hosting the sdc-lib files on your own infrastructure whenever possible. This gives you full control over:
- performance (caching, compression, latency)
- availability and resilience (no dependency on public CDN uptime)
- headers and MIME types for .wasm, .js, .model files
- exact versioning of the SDK assets
When you self‑host, make sure that:
-
libraryLocationinDataCaptureContext.forLicenseKeypoints to the correctsdc-libfolder URL. - The
sdc-libfolders you serve match exactly the version of the installed@scandit/web-datacapture-*npm packages. - All files from
sdc-libare copied recursively and served with correct MIME types and caching headers.
For concrete examples and the latest best practices, please refer to these sections of the documentation:
- Install via CDN:
https://docs.scandit.com/sdks/web/add-sdk/#install-via-cdn - Configure the library and libraryLocation:
https://docs.scandit.com/sdks/web/add-sdk/#configure-the-library - Hosting the sdc-lib files (self‑hosting details and server config hints):
https://docs.scandit.com/sdks/web/add-sdk/#hosting-the-sdc-lib-files