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.

Home Page:https://react-unity-webgl.dev

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

bug: missing distribution types

andrewjtorres opened this issue · comments

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?

  • yes, I would like to contribute a fix

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

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

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