Skip to content

Conversation

mattes3
Copy link

@mattes3 mattes3 commented Apr 26, 2019

I had problems because I am using a newer version of React. Because react-unity-webgl has its own dependency on a particular React version, this caused two versions of React to be loaded.

I have contributed this patch that makes it work regardless of the exact version of React.

Matthias Bohlen added 2 commits April 26, 2019 10:57
@jeffreylanters
Copy link
Owner

jeffreylanters commented Apr 26, 2019

Hey @mattes3! Thanks for your pull request. I never though of / encountered this problem, thanks for bringing it up. Lot's of questions. But first of all, your approach is interesting. Is this the regular way this problem is solved?

It looks like I have to compile using TypeScript, pack, uninstall and install every time I want to test my component. That would make the development progress very painfully. And the typing dependency, this way it should match the version in your project, which can also be different, right? Can you give a little more details on the development cycle?

@mattes3
Copy link
Author

mattes3 commented Apr 26, 2019

Hey @jeffreylanters , you're welcome!

Regarding the dev/test cycle: I would only use it just before publishing a new version of react-unity-webgl to npm, just to make sure that everything is perfectly OK. I would not use it during day-to-day development, although the cycle takes only 3 seconds on my machine (I put all the statements into one command line, separated by semicolons).

I tried to use your dev cycle with the test repo because it will be even faster. I simply cloned the test repo and tried "npm install", then "npm start". However, on my machine it did not work because the webpack dev server did not open any port on the local machine. Webpack listens for changes to the source files but it does not serve them on any port. Do you know why this happens?

@jeffreylanters
Copy link
Owner

Thanks for your explanation. One more thing I'm not quite understanding is, before packing the module, it has to be compiled from TypeScript to JavaScript. How can this be done when the React dependency is missing?

@mattes3
Copy link
Author

mattes3 commented Apr 27, 2019

Thanks for your explanation. One more thing I'm not quite understanding is, before packing the module, it has to be compiled from TypeScript to JavaScript. How can this be done when the React dependency is missing?

To compile some code from Typescript to Javascript, you don't need the code of the dependencies, you only need to add the types as a devDependency. In this case: Add @types/react as a devDependency.

@mattes3
Copy link
Author

mattes3 commented Apr 27, 2019

And the typing dependency, this way it should match the version in your project, which can also be different, right?

The version of the typing dependency is not that critical because your code only uses a small portion of the React API that will likely remain as it is in future versions (e.g. React.Component).

@mattes3
Copy link
Author

mattes3 commented Apr 27, 2019

Hi Jeffrey,

please forget about my development cycle stuff in README.md. It's not really necessary for this patch and is more or less a matter of taste. However, the removed React dependency is important for me.

When do you plan to merge this (without the README)? I could then remove my local version of react-unity-webgl and charge ahead. :-)

Cheers,
Matthias

@jeffreylanters
Copy link
Owner

Hi @mattes3, thank you very much for your explanation. I've learned something new today! I'll be merging this today, but will probably release it later today or tomorrow. Because I have another branch with an important fix we've been testing I want to release with it. I will add your readme section to the wiki. 😄

@jeffreylanters jeffreylanters merged commit 13b7910 into jeffreylanters:master Apr 27, 2019
@jeffreylanters
Copy link
Owner

jeffreylanters commented Apr 27, 2019

I've merged everything into the development branch and added the development section of the readme to the wiki. I'll be doing some tests on some environments (feel free to test with me), I'll let you know when I'll be releasing the new version 7.1.0.

Thanks you so much for helping and contributing to this module! :)

@jeffreylanters
Copy link
Owner

jeffreylanters commented Apr 27, 2019

Good news, all the tests have been successful. I've updated the test repository and released React Unity WebGL version 7.1.0 / 7.1.1 🎉

thanks again for all your help and contributing! Have a great weekend!

@mattes3
Copy link
Author

mattes3 commented May 2, 2019

Wow, thanks a lot, Jeffrey. I'll test it during this month when I get on with the project.

@mattes3
Copy link
Author

mattes3 commented May 4, 2019

The new version 7.1.1 works for me! Thanks, Jeffrey.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants