jeffreylanters / react-unity-webgl

React Unity WebGL provides a modern solution for embedding Unity WebGL builds in your React Application while providing advanced APIs for two way communication and interaction between Unity and React.
https://react-unity-webgl.dev
Apache License 2.0
1.73k stars 163 forks source link

bug: missing distribution types #512

Closed andrewjtorres closed 1 year ago

andrewjtorres commented 1 year ago

Please avoid duplicates

Language and Compiler

Other TypeScript compiler

What environment are you using?

Local Development Server

When does your problem occur?

While writing code

What does your problem relate to?

The problem seems Module related

React-Unity-WebGL Version

9.4.1

React Version

18.2.0

Unity Version

2022.3.0f1

What happened?

The latest release appears to be missing the distribution/types folder which produces broken types within a TypeScript application.

Version 9.4.1 on NPM: https://www.npmjs.com/package/react-unity-webgl?activeTab=code

Example:

Screenshot 2023-05-31 at 10 46 14 AM

Screenshot 2023-05-31 at 10 47 51 AM

Reproducible test case

import { useUnityContext } from 'react-unity-webgl'

export const Example = () => {
  const { addEventListener } = useUnityContext({
    codeUrl: `/build/code.wasm.br`,
    dataUrl: `/build/asset.data.br`,
    frameworkUrl: `/build/framework.js.br`,
    loaderUrl: `/build/loader.js`,
    streamingAssetsUrl: `/streaming-assets`,
  })

  return null
}

Would you be interested in contributing a fix?

jeffreylanters commented 1 year ago

Thanks for the report. You are right! I'm going to look into it!

jeffreylanters commented 1 year ago

Sorry for the delay. The issue is resolved in the latest release v9.4.2.

andrewjtorres commented 1 year ago

No worries! Thanks for addressing the issue and maintaining this awesome repo. 🎉