Skip to main content

Using Pre-Built Modules

  1. Add the library as a dependency to your project

    npm install opencascade.js@beta
  2. Configure your bundler to load .wasm files as URLs. If you don't want to use a bundler, you can manually pass in the URLs to the WASM files in the next step.

    For webpack, first add the file-loader dependency.

    npm install file-loader --save-dev

    Then add the following configuration to your webpack.config.js.

    module: {
    rules: [
    {
    test: /\.wasm$/,
    type: "javascript/auto",
    loader: "file-loader"
    }
    ]
    },
    node: {
    fs: "empty"
    }
  3. In your JavaScript file, instantiate the library:

    import initOpenCascade from "opencascade.js";

    initOpenCascade().then(oc => {
    // Check out the examples on how to use this library!
    });