facebook / docusaurus

Easy to maintain open source documentation websites.
https://docusaurus.io
MIT License
56.29k stars 8.45k forks source link

Can't import @splinetool/react-spline #10595

Closed kwalczi16 closed 6 hours ago

kwalczi16 commented 7 hours ago

Have you read the Contributing Guidelines on issues?

Prerequisites

Description

Hello, I was trying to display Spline animation in my docusaurus project. It works locally, but build keeps failing. This is my implementation:

import React, { lazy } from 'react'
import BrowserOnly from '@docusaurus/BrowserOnly'

export const SplineComponent = () => {
  const Spline = lazy(() => import('@splinetool/react-spline'))
  return (
    <BrowserOnly fallback={<div>Loading...</div>}>
      {() => {
        return <Spline scene="https://prod.spline.design/{hash}/scene.splinecode" />
      }}
    </BrowserOnly>
  )
}

The error I am receiving:

[cause]: Error: Failed to compile due to Webpack errors.
  Module not found: Error: Package path . is not exported from package C:\Users\...\node_modules\@splinetool\react-spline (see exports field in C:\Users\...\node_modules\@splinetool\react-spline\package.json)

The exports block in spline's package.json looks like this:

"exports": {
    ".": {
      "types": "./dist/Spline.d.ts",
      "import": "./dist/react-spline.js"
    },
    "./next": {
      "types": "./dist/next/SplineNext.d.ts",
      "import": "./dist/react-spline-next.js"
    }
  },

What am I missing? I have been struggling for a few hours already, and I have no idea what else I can do.

Reproducible demo

No response

Steps to reproduce

N/A

Expected behavior

Display spline animation

Actual behavior

I cannot build my docusaurus project

Your environment

Self-service

slorber commented 6 hours ago

We kindly ask you to provide a runnable docusaurus.new repro using the very latest version of Docusaurus