Trying to use '@react-three/drei' in Next.js - Error: No "exports" main defined in @monogrid/gainmap-js/package.json

I am trying to load my GLTF model in Next.js app using @react-three/drei but when loading my model I get this:

Server Error

Error: No “exports” main defined in /Users/primozrome/Documents/WEB/dewesoft-website/node_modules/@monogrid/gainmap-js/package.json
This error happened while generating the page. Any console logs will be displayed in the terminal window.

Ayone knows what is going on? Here is the code:

import { Canvas } from '@react-three/fiber';
import { Model } from '../../public/Obsidian';

const GeneralProductHeader = ({ title, subtitle, description, cover, icons, onOpen, height}) => {
  const { t } = useTranslation();
  const { asPath, locale } = useRouter();
  const origin =
    typeof window !== 'undefined' && window.location.origin
      ? window.location.origin
      : '';
  const url = `${origin}${asPath}`;
  const openDrawer = () => {
    va.track('QUOTATION DRAWER', {
      trigger: 'PRODUCT HEADER',
      product: title,
      url: url,
      locale: locale

  return (
          <Model />

If I remove the Model import, the error is gone!

could you go a version back? monogrid gainmap was just added to drei, may something wrong with gainmap-js, we will investigate

1 Like

@Primoz_Rome can you please try this node.js - Error [ERR_PACKAGE_PATH_NOT_EXPORTED]: No "exports" main resolved in /app/node_modules/@babel/helper-compilation-targets/package.json - Stack Overflow looks like it could be just an update issue.

1 Like

gainmap released an update No “exports” main defined in @monogrid/gainmap-js · Issue #35 · MONOGRID/gainmap-js · GitHub
maybe it helps. will be live in drei in a few minutes.


@Primoz_Rome gainmap.js developer here, I hope v3.0.5 (and the upcoming drei version) resolves your problem.

In case it doesn’t: would you be kind enough to participate in this discussion No “exports” main defined in @monogrid/gainmap-js · Issue #35 · MONOGRID/gainmap-js · GitHub and, if possible, maybe post a minimum reproducibility example or steps to reproduce the problem? That would really help nail down a possible resolution (if this fix doesn’t work).


1 Like

I will work on the suggestions, really appreciate the help from you guys!