Error updating to version 1.38.0 of PlayCanvas NPM

Hello All,
have just updated the npm versión of canvas and I am getting this error in execution.
Something has changed? (I am using typescript playcanvas migrating from 1.37.1 to 1.38.0)

TypeError: Class constructor ScriptType cannot be invoked without 'new’
at new scriptType (playcanvas.mjs:65478)
at ScriptComponent.create (playcanvas.mjs:53254)
at Cameras.createOrbitCamera (cameras.ts:36)

my code:

camera.script.create("orbitCamera", {
                attributes: {
                    inertiaFactor: 0.2, // Override default of 0 (no inertia)
                    focusEntity: lookatEntity,
                    defaultEntity: defaultLookatEntity

thanks in advance :slight_smile:

Looks like you’re now using the newly introduced module build of the engine (playcanvas.mjs) instead of the ES5 build (playcanvas.js). Can you switch to the ES5 version to see if that works OK?

sorry for my unkowledge. How do you switch to the ES5 version?
Modifying the tsconfig.json?
I have:
“compilerOptions”: {
“target”: “es5”,
“module”: “es6”,
“outDir”: “./dist/”,

I don’t know actually! Hmm. @kungfooman - do you know?

Well, I have just deleted playcanvas.mjs from the node_modules, and it looks like it fallsback to playcanvas.js. Now it is working :slight_smile:


Hey @slimbuck + @Elliott - we should rebuild the glTF viewer against 1.38.0 and see if it works with the new module.