alioguzhan/react-typescript-library

More than one copy of React in [Test App]

Closed this issue ยท 8 comments

Describe the bug

  • Actually this is not Bug but need to add in rollup.config.js.

  • This is Link of Stackoverflow

  • in Second Answers You see as Webpack he added external version of React so i don't know how to add in rollup.config.js

  • This is Future Bug of this repo so that i informed through this Issue Report

How I Discovered this Error in My TestApp and TestLibrary ?
I am creating Powerful Route Authorization Library that has Prevention from

  • Browsers
  • Devices
  • OS
  • AuthState
  • RoleState
  • Automatic Role by Role Redirect through after login [admin => /admin/dashboard , user => /home , vip => /home/vip ect.]
  • IP , Bots etc.

    This Library already i created and working fine in local file as part of every react app.
    i need to clear one and only this error that i seen 3 months ago and still seeing.
    i tryed every working library like react-router-dom, Muicore , 7+ teamplates but this repo has give me some confidence that i can transform it so please help me ! with ping heare


    Thanks for Read and give me your valuable time.

Hey, react, react-dom, and the library should be linked to the library modules. Please see the below line:

https://github.com/alioguzhan/react-typescript-library/blob/main/tools/init.ts#L159

So, in your example app's package.json, there should be something like this:

"my-library": "link:..",
"react": "link:../node_modules/react",
"react-dom": "link:../node_modules/react-dom",

With this, we shouldn't see that multiple version of react error.

If you don't have it this way, you may use an old version of this template.

Can you please check your package.json check if this is the case?

Sorry i doesn't see same issue i opened that has same solution. i forgot about that i open this issue without seeing. ๐Ÿค
thankyou very much. Side Effects of tomuch coding๐Ÿ˜

This Solution is Not Working See That Screenshots

#1 Main Export File of Library
image
#2 Package Json File of Local Test App
image
#3 App.js File on Local Test App
image
#4 Output
image

@alioguzhan

Why are you importing another React as React2? This is expected since you have 2 Reacts now.

Debugging Testlibrary React and TestApp React is Same or not this give me not same.
As stackoverflow Answers.

I tested Local and Published Library that has giving me same Error.

@alioguzhan

I now trying to use your userscreen hook and resetting my present TestLibrary

I am not sure how this template can help your situation since you are explicitly importing 2 different React.

I don't see any use case for this, but if you believe there is try tweaking the rollup config or module system.

I am closing this as out of scope.

I Got a Successfully working Library that's working fine.

Thanks @alioguzhan for Helping and Support ing to me

userscreen template worked for me.

I am glad that you made it. ๐Ÿš€