SciChart.js JavaScript 2D Charts API > The SciChartSurface (Root Chart Control) > Deploying Wasm (WebAssembly) and Data Files with your app
Deploying Wasm (WebAssembly) and Data Files with your app

Deploying Wasm (WebAssembly) and Data Files with your app

If you receive an error message when running your app, you may not have deployed the Wasm (WebAssembly) or data files correctly. Below are some steps on how to resolve that.

Error: Could not load SciChart WebAssembly module. Check your build process and ensure that your scichart2d.wasm, scichart2d.data and scichart2d.js files are from the same version

Option 1: Package Wasm & Data Files with WebPack (or similar) 

In our tutorials and boilerplate examples we show you how to package the Wasm & Data files to load them in a variety of JavaScript frameworks. Find the links to setting up a JavaScript project below:

JS Project framework Boilerplate Project or Setup Instructions
npm / webpack Tutorial - Setting up a project with WebPack
Vanilla Javascript (no npm, webpack) Tutorial - Including SciChart.js in an HTML Page
npm / webpack / react code sample
vue.js code sample
nextjs code sample
Angular code sample
blazor via JS Interop code sample
Electron code sample

 

See more boilerplate examples for JavaScript frameworks at our Github repository: github.com/abtsoftware/scichart.js.examples under the Sandbox folder  

Option 2: Load Wasm from URL with SciChartSurface.configure() or useWasmFromCDN()

The easiest way for SciChart.js to load WebAssembly and Data files are to load them from our CDN (see jsdelivr.com/package/npm/scichart). This method is particularly useful in projects or frameworks that don't have a package manager or module bundler.

To do load SciChart's Wasm and Data file from CDN, call SciChartSurface.configure() once before any SciChartSurface is shown:

Configure Wasm and Data File URLs
Copy Code
import {SciChartSurface} from "scichart/Charting/Visuals/SciChartSurface";
import { libraryVersion } from "scichart/Core/BuildStamp";
// Load Wasm & Data files from URL
// This URL can be anything, but for example purposes we are loading from JSDelivr CDN
SciChartSurface.configure({
   dataUrl: `https://cdn.jsdelivr.net/npm/scichart@${libraryVersion}/_wasm/scichart2d.data`,
   wasmUrl: `https://cdn.jsdelivr.net/npm/scichart@${libraryVersion}/_wasm/scichart2d.wasm`
});

We've packaged a helpful function that automatically loads the latest & correct version of SciChart's Wasm & Data files from CDN. To use this, instead of calling SciChartSurface.configure() passing in a URL, call SciChartSurface.useWasmFromCDN().

Load Wasm from CDN
Copy Code
import {SciChartSurface} from "scichart/Charting/Visuals/SciChartSurface";

export async function initSciChart() {
    // Call this once before any SciChartSurface is shown.
    // This is equivalent to calling SciChartSurface.configure() with the CDN URL (JSDelivr)
    SciChartSurface.useWasmFromCDN();
}