aps-simple-viewer-nodejs
aps-simple-viewer-nodejs copied to clipboard
Move to ES6 modules
Migrating the Node.js code to ES6 modules might not only make the code more up-to-date but also streamline the step-by-step tutorials. For example, if we want to add functionality into a Node.js file incrementally, instead of
const service = module.exports = {};
service.someFunction = async () => {
// ...
};
service.anotherFunction = async () => {
// ...
};
we can just do
export async function someFunction() {
// ...
}
export async function anotherFunction() {
// ...
}
It would also drastically improve the developer experience when using this in bundled apps, e.g. using Angular framework, Vite etc. Huge JS files like the viewer3D.js files are not something we really like to include in our apps as it breaks the usual pattern of managing dependencies in a package.json.
Unfortunately, the Terms & Conditions at the top of viewer3D.js state that
The Autodesk Viewer SDK JavaScript must be delivered from an Autodesk-hosted URL.
So bundling the JavaScript SDK is not something we support.
Yeah, we just saw that as well. Are there any plans that this is going to change in the future?
The rest of our app is offline compatible. Do you know of a more detailed statement regarding this? What about caching the js file on the client (e.g. only downloading it during the first installation)?
There are no plans to change this restriction as far as I know. Please see https://aps.autodesk.com/blog/disconnected-workflows for more details on how you can cache viewer assets in an official/supported way.