I am new to Three.js and web-ifc. I was following the tutorial on docs.thatopen.com. I am running my server on next.js and my objective was to build an app that renders fragments, but then i get this error
## Error Type
Build Error
## Error Message
Export MRTNode doesn't exist in target module
## Build Output
./node_modules/@thatopen/fragments/dist/FragmentsModels/src/model/material-manager.mjs:1:1
Error: Export MRTNode doesn't exist in target module
> 1 | import * as THREE from "three";
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2 | import { CurrentLod, ObjectClass } from "./model-types.mjs";
3 | import { installCaptureEmission, setCaptureEmission, setCapturePixels } from "./capture-emi...
4 | import { targetAwareMRT } from "./target-aware-mrt.mjs";
The export MRTNode was not found in module [project]/node_modules/three/build/three.module.js [app-client] (ecmascript).
Did you mean to import ClampToEdgeWrapping?
All exports of the module are statically known (It doesn't have dynamic exports). So it's known statically that the requested export doesn't exist.
Import traces:
Client Component Browser:
./node_modules/@thatopen/fragments/dist/FragmentsModels/src/model/material-manager.mjs [Client Component Browser]
./node_modules/@thatopen/fragments/dist/FragmentsModels/src/model/mesh-manager.mjs [Client Component Browser]
./node_modules/@thatopen/fragments/dist/FragmentsModels/index.mjs [Client Component Browser]
./node_modules/@thatopen/components/dist/index.mjs [Client Component Browser]
./app/page.tsx [Client Component Browser]
./app/page.tsx [Server Component]
Client Component SSR:
./node_modules/@thatopen/fragments/dist/FragmentsModels/src/model/material-manager.mjs [Client Component SSR]
./node_modules/@thatopen/fragments/dist/FragmentsModels/src/model/mesh-manager.mjs [Client Component SSR]
./node_modules/@thatopen/fragments/dist/FragmentsModels/index.mjs [Client Component SSR]
./node_modules/@thatopen/components/dist/index.mjs [Client Component SSR]
./app/page.tsx [Client Component SSR]
./app/page.tsx [Server Component]
Next.js version: 16.4.3 (Turbopack)
It seems like the builder is trying to get an MRTNode class or function from Three.js module, I don’t know if this is a versioning issue, or if there is something that i am yet to install
This is the code i am running
import * as THREE from "three";
import Stats from "stats.js";
import * as BUI from "@thatopen/ui";
import * as OBC from "@thatopen/components"
export default async function Home() {
const container = document.getElementById("container")!;
const components = new OBC.Components();
const worlds = components.get(OBC.Worlds);
const world = worlds.create<
OBC.SimpleScene,
OBC.SimpleCamera,
OBC.SimpleRenderer
>();
world.scene = new OBC.SimpleScene(components);
world.renderer = new OBC.SimpleRenderer(components, container);
world.camera = new OBC.SimpleCamera(components);
components.init();
const workerUrl = await OBC.FragmentsManager.getWorker();
const fragments = components.get(OBC.FragmentsManager);
fragments.init(workerUrl);
world.camera.controls.addEventListener("update", () => fragments.core.update());
// Remove z fighting
fragments.core.models.materials.list.onItemSet.add(({ value: material }) => {
if (!("isLodMaterial" in material && material.isLodMaterial)) {
material.polygonOffset = true;
material.polygonOffsetUnits = 1;
// eslint-disable-next-line react-hooks/purity
material.polygonOffsetFactor = Math.random();
}
});
fragments.list.onItemSet.add(({ value: model }) => {
model.useCamera(world.camera.three);
world.scene.three.add(model.object);
fragments.core.update(true);
});
const fragPaths = [
"https://thatopen.github.io/engine_components/resources/frags/school_arq.frag",
];
await Promise.all(
fragPaths.map(async (path) => {
const modelId = path.split("/").pop()?.split(".").shift();
if (!modelId) return null;
const file = await fetch(path);
const buffer = await file.arrayBuffer();
return fragments.core.load(buffer, { modelId });
}),
);
const panel = BUI.Component.create<BUI.PanelSection>(() => {
return BUI.html`
<bim-panel label="Worlds Tutorial" class="options-menu">
<bim-panel-section label="Controls">
<bim-color-input
label="Background Color" color="#202932"
@input="${({ target }: { target: BUI.ColorInput }) => {
world.scene.config.backgroundColor = new THREE.Color(target.color);
}}">
</bim-color-input>
<bim-number-input
slider step="0.1" label="Directional lights intensity" value="1.5" min="0.1" max="10"
@change="${({ target }: { target: BUI.NumberInput }) => {
world.scene.config.directionalLight.intensity = target.value;
}}">
</bim-number-input>
<bim-number-input
slider step="0.1" label="Ambient light intensity" value="1" min="0.1" max="5"
@change="${({ target }: { target: BUI.NumberInput }) => {
world.scene.config.ambientLight.intensity = target.value;
}}">
</bim-number-input>
</bim-panel-section>
</bim-panel>
`;
});
document.body.append(panel)
return (
<>
<div id={"container"}></div>
</>
);
}
Below is the result of the command “npm la three”.
PS C:\\myown\\CODEPROJECTS\\test_projects\\web-ifc-learn> npm ls three
[web-ifc-learn@0.1.0](mailto:web-ifc-learn@0.1.0) C:\\myown\\CODEPROJECTS\\test_projects\\web-ifc-learn
+-- @[thatopen/components@3.6.0](mailto:thatopen/components@3.6.0)
| +-- [camera-controls@3.1.2](mailto:camera-controls@3.1.2)
| | `-- three@0.186.1 deduped | +-- three-mesh-bvh@0.9.9 | | `-- [three@0.186.1](mailto:three@0.186.1) deduped
| `-- three@0.186.1 `-- @[thatopen/fragments@3.6.0](mailto:thatopen/fragments@3.6.0)
\`-- [three@0.186.1](mailto:three@0.186.1) deduped