I recently started using canvas-sketch to create some exciting Three.js content.
For my Three.js template, I utilized the following command:
canvas-sketch --new --template=three --open
The version that got installed is 1.11.14
canvas-sketch -v
When attempting to access THREE.ParametricGeometry, an error pops up saying "THREE.ParametricGeometry has been moved to /examples/jsm/geometries/ParametricGeometry.js"
// Ensuring that ThreeJS is available globally for 'examples/'
global.THREE = require("three");
// Including any additional ThreeJS examples below
require("three/examples/js/controls/OrbitControls");
const canvasSketch = require("canvas-sketch");
// code
const geometry = new THREE.ParametricGeometry(calculateHelicoid, 25, 25)
// more code here
To address this issue, I added the following require statement
require("three/examples/jsm/geometries/ParametricGeometry.js")
However, a new error occurred:
ParseError: 'import' and 'export' may appear only with 'sourceType: module' on line 6 threejs_marbles/node_modules/three/examples/jsm/geometries/ParametricGeometry.js
Is there a solution to this problem?