Use as a node module

I’m trying to integrate the Shapediver viewer into a React/Typescript project. The documentation says that there’s only minified variants:

https://viewer.shapediver.com/v2/2.19.2/doc/usage.html

But I would like to use the viewer as a node module and use the import keyword in JS. I’ve found type definitions https://www.npmjs.com/package/shapediver-types but this doesn’t seem to map to a NPM package.

Is the viewer also available as an unminified (hopefully Typescript) version? If not, is there a way to use it as such?

Thanks!
Rens

We don’t deliver an unminified version, but you can use this example to see how to use the ShapeDiver Viewer in React: https://codepen.io/ShapeDiver/pen/oNvoBxb?editors=1010
Please install the shapediver-types package using npm, and add “shapediver-types” to compilerOptions.types of your tsconfig.json
In your TypeScript files please use sth like import { Api } from 'shapediver-types'

1 Like

Hi,

I wonder how to find which ‘shapediver-types’ version corresponds to which ‘viewer’ version, because it looks like the two packages don’t use the same schema.

For example shapediver-types has 77 versions from 1.0.1 till 1.0.78 (only the minor changes)
And for the viewer I am using 2.19.0

Thanks in advance,
Ventsi