Skip to main content

Requirements

  • Node.js 22.13 or newer for server-side use and repository tooling
  • An ESM-capable project
  • A modern browser with WebAssembly for client-side evaluation
  • TypeScript is recommended but not required by consumers
InvariantCAD is ESM-only. CommonJS require("invariantcad") is not a supported entry path.

Add the package

The package includes the TypeScript declarations with their JSDoc, bundled Manifold JavaScript/WebAssembly runtime, and the stock occt-wasm dependency. The optional InvariantCAD-owned OCCT facade is not downloaded implicitly and is not part of the 0.2 npm package.

Confirm ESM configuration

For Node.js, use an ESM source file (.mjs) or mark the consuming package as ESM:
package.json
Then verify a default-kernel import:

TypeScript settings

InvariantCAD targets modern ESM and works best with a modern module resolver:
tsconfig.json
Bundler-based applications can use module: "ESNext" and moduleResolution: "Bundler" instead.

WebAssembly assets

The default Manifold runtime is bundled with InvariantCAD. In a normal Vite or similar production build, the runtime resolves its sibling WASM asset through import.meta.url. If an environment rewrites asset URLs, pass the final URL:
The Manifold module is initialized once per JavaScript realm, so pass wasmUrl on the first initialization in each page or worker. After a successful initialization, a later request cannot change the configured URL, including after an initialization that used the default location. A failed initialization is not cached: a later call can retry with the same or a corrected URL. OCCT has a larger separate runtime and additional initialization forms. Follow the OpenCascade guide for Node, browser, and custom facade setup.

Package-manager install scripts

InvariantCAD needs no install scripts. Neither the package nor its runtime dependencies (occt-wasm, zod, and comlink through occt-wasm) declare preinstall, install, postinstall, or prepare scripts, and the Manifold and stock OCCT WebAssembly runtimes ship prebuilt inside the installed packages. Installing with npm install --ignore-scripts, or under pnpm’s default policy of blocking dependency build scripts, is supported: the release gate installs the packed package with --ignore-scripts before running its clean-consumer smoke test. Do not allow install scripts on InvariantCAD’s behalf. If other tooling in your application, such as a bundler or browser test runner, needs one, follow that tool’s documentation, scope the exception to that package, and keep the lockfile reviewed.
Never copy a WASM file from an unrelated version. JavaScript glue and WASM binaries are a matched pair. A mismatch can fail during initialization or, for native facade extensions, violate the advertised ABI.

Next step

Build and export a parameterized model in the quickstart.