Skip to content
Advertisement

Use three.js in google web app script – not able to use the script module type to load three.js

I would like to use three.js in the google web script to load 3D CAD file, while in the installation instruction on threejs.org it explains the script need to be “module” type. At the same time, it looks like the google web app script does not support the “module” after I googled around for several days.

Is there anyone ever used three.js for google script? Thanks a lot for sharing your experience. otherwise I have to give up my idea to load CAD data on the web app I am building.

JavaScript

Advertisement

Answer

Modules are not supported with Apps Script

From: https://developers.google.com/apps-script/guides/v8-runtime#modern_ecmascript_syntax

Caution: ES6 modules are not yet supported.

You can however call the script like you would a library such as jQuery.

JavaScript

Web App Example

Code.gs

JavaScript

index.html

JavaScript

Adapted from: https://threejs.org/docs/index.html#manual/en/introduction/Creating-a-scene

Result

When deploying this as a Web App I get this result:

enter image description here

References

User contributions licensed under: CC BY-SA
1 People found this is helpful
Advertisement