g-loot / react-tournament-brackets

React component library for displaying bracket leaderboards
https://sleepy-kare-d8538d.netlify.app/?path=/story/components-bracket--bracket
GNU Lesser General Public License v2.1
219 stars 69 forks source link

Update webpack config for both browser and Node.js (incl. Next.js) #61

Open zarganum opened 1 year ago

zarganum commented 1 year ago

This will resolve the #34, #51 and potentially many others. https://webpack.js.org/configuration/output/#outputglobalobject

The dynamic imports "workaround" in #34 prevents our npm run build and thus blocks the whole dev pipeline.

May I also suggest to review the current versions as some of them are 2+ years old.

Meanwhile (if anyone else is suffering from the same issue): in your text editor, open the node_modules/@g-loot/react-tournament-brackets/dist/bundle.js and add just one line in the very beginning:

const window = global.window;

many thanks

UTkzhang commented 1 year ago

@zarganum confirmed fix, can we merge and re-release, this is a fairly urgent bug haha (@Shenato)

notShadowM commented 11 months ago

@zarganum will the merge be soon? because it is needed :(

zarganum commented 11 months ago

@zarganum will the merge be soon? because it is needed :(

I'd be more than happy... but I'm not the owner of this repo and not having write permissions, pls. ask @Shenato

Shenato commented 11 months ago

Are you certain this doesn't have any drawbacks to how the library is compiled?

Have you tested it with non-nextjs projects. Like the main target this library has which is regular client side react libraries?

I have very little experience with this particular change in web pack so I would like confirmation with some end user testing that it works for client side rendering and server side as well.

feldrok commented 10 months ago

I need this! I can't use this on Next.js without this update + the window config...

arathael commented 10 months ago

While this gets merged, can someone please point out how to importa the forked repo? Is that possible since they have the same pacakge name and I am not being able to import normally or with the full user/repo format.

feldrok commented 9 months ago

While this gets merged, can someone please point out how to importa the forked repo? Is that possible since they have the same pacakge name and I am not being able to import normally or with the full user/repo format.

Haven't been able to do it, Vercel installs the package from npm. A workaround for this would be great.

Shenato commented 9 months ago

Hey guys, Sorry for the late response, I wasn't sure this change was what was needed for the package overall, so I went ahead and migrated the package to not be compiled as a better way to make sure it supports nextjs and is more aligned with how packages today are built and so on

Please let me know if this PR fixes it https://github.com/g-loot/react-tournament-brackets/pull/64

You can easily test it by npm installing this beta release https://www.npmjs.com/package/@g-loot/react-tournament-brackets/v/1.0.31-rc

reckziegelwilliam commented 3 months ago

Hey! Just a quick reminder to the great devs who have developed this library about the open issue. Would love to integrate this library into my Next/React app but hesitant to given any further issues that may have developed in the last 6 months.

Shenato commented 1 month ago

Hey! Just a quick reminder to the great devs who have developed this library about the open issue. Would love to integrate this library into my Next/React app but hesitant to given any further issues that may have developed in the last 6 months.

Hey this library has moved to be under my personal github, because the organization that it is under now is no more. So they've kicked every dev out of the organizing which means no one can contribute to this repo as of today.

I'll try to get this particular fix merged under my own fork of this repo and publish some details on how to swap packages soon. Hopefully this weekend.

Shenato commented 1 month ago

https://github.com/Shenato/react-tournament-brackets

This is where the package lives now.

Please check it out and give me feedback if you're able to install the new package. It no longer has the @g-loot/ prefix.

Shenato commented 1 month ago

Try installing this package instead and see if it works with you guys on next.js

https://www.npmjs.com/package/react-tournament-brackets