收到错误 "requested module './three-csg.js' does not provide an export named 'CSG' "

getting error "requested module './three-csg.js' does not provide an export named 'CSG' "

我正在对立方体和球体进行一些简单的 CSG 操作。为此,我正在使用三个-csg.js 库形式“https://github.com/manthrax/THREE-CSGMesh”在进行操作后,我收到类似“Uncaught SyntaxError: The requested module './three-csg.js' does not provide an export named 'CSG' “
编码如下,还根据需要添加了其他两个库(csg-lib.js, csg-lib.js)

import { CSG } from "./three-csg.js";

// -----------------------------------------------------(scene, camera, renderer are defined)

const cubegeometry = new THREE.BoxGeometry( 0.02, 0.02, 0.02 );
const cubematerial = new THREE.MeshBasicMaterial( {color: 0x00ff00,} );
const cube = new THREE.Mesh( cubegeometry, cubematerial );
const cubegeometry = new THREE.BoxGeometry( 0.02, 0.02, 0.02 );
const cubematerial = new THREE.MeshBasicMaterial( {color: 0x00ff00,} );
const cube = new THREE.Mesh( cubegeometry, cubematerial );
const cubeCSG   = CSG.fromMesh(cube);
const sphereCSG = CSG.fromMesh(sphere);
const resultCSG = cubeCSG.subtract(sphereCSG); 
const CSGmaterial = new THREE.MeshBasicMaterial( { color: 0xff0000 } );
const meshCSG = CSG.toMesh( resultCSG );
meshCSG.material = CSGmaterial;

scene.add( meshCSG );

你看过demo的源代码了吗?您只需remove the curly braces

import CSG from "./three-csg.js";