Use viewer API in webpack project

api

(Nikunjarora12345) #1

Hi,
I’d like to use the sketchfab viewer API in my vue js webpack project. Do the viewer API script export the sketchfab object using es6 standard? If not how should I import the sketchfab js file in my project

Thnx


(Arthur Jamain) #2

Hey there :slight_smile:

There is no es6-exported version of the viewer API currently. You should however be able to import the file with a previous syntax, such as const Sketchfab = require('./sketchfab-viewer-1.2.0');. In a babel-processed code, you could most likely use the import syntax. However, there is no destructuring at all currently.

Reworking the shipping method for the viewer api is on the roadmap, but we’re not there yet.

Hope that helps,

edit : you can check out the exporting code at the top of the file for full clarity ( https://static.sketchfab.com/api/sketchfab-viewer-1.2.0.js )