react-router
react-router copied to clipboard
[Bug]: 6.4 release changed folder structure? UNPKG links broke a few minutes ago
What version of React Router are you using?
6.4.0
Steps to Reproduce
Linking to UNPKG.com using a version of @6 with the standard old script link urls of:
<!-- Load React Router and React Router DOM -->
<script src="https://unpkg.com/react-router@6/umd/react-router.development.js" crossorigin></script>
<script src="https://unpkg.com/react-router-dom@6/umd/react-router-dom.development.js" crossorigin></script>
is broken (404's)
the path on UNPKG of /umd which was present up to 6.3 is now /dist/umd in 6.4.0
so all script references to the old CDN path structure lead to 404's and apps breaking
I'm not sure if you guys manage the UNPKG releases or how that works but my app just broke fully a few minutes ago when 6.4.0 launched.
TEMPFIX: changed my link to ... @6.3/umd/ ...
Expected Behavior
Expect 6.4.0 to load at https://unpkg.com/react-router@6/umd/react-router.development.js
Actual Behavior
Server returns a 404 due to path change including /dist folder
Unpkg will respect the main field in package.json when loading the package without a deep path specified, so https://unpkg.com/react-router@6 properly redirects you to the new 6.4.0 files. Deep imports to specific build-time directories are not considered public API. I would recommend either pinning to a version (like you've done) or using the non-deep URL of https://unpkg.com/react-router@6 if you want automatic updates.
Gotcha.
I tried the above and the console just starts throwing errors left and right on 6.4.0.
I pinned to 6.3.0 for now until I have time to figure out why 6.4 breaks everything.
ok - please file any issues you find - it should be non-breaking for current 6.3.0 apps
I think I'm running into the same issue, so it should be reopened:
When loading the umd builds for react-router and react-router-dom, they are trying to load the umd build for @remix-run/router, but I'm not able to find such a build. But this would be required in order to add it to my import map. (I tried to add both dist/router.js or dist/router.cjs.js but both obviously fail with syntax errors when they are loaded in the browser.)
When comparing the rollup configs for both packages, it looks like @remix-run/router doesn't produce a umd build.
The other packages also have an unpkg key in their package.json, which @remix-run/router doesn't have.
(The history package that was a dependency until 6.3.0 did provide such a build.)
Until such a build is provided we are not able to upgrade.
I still have the issue when trying to use automatic latest release. I haven't had time to look at it and when I specifiy 6.4 I get a stream of console errors. I just stuck to 6.3.0 for now until I have more time to look at it closer.
But the path structure definitely changed from 6.3.x to 6.4.0. everything is nested under a dist folder when it's never been before all the way back to v4.x.
This definitely broke anyone who used tutorials online from sites that suggest linking to unpkg for the source if you aren't using a build system or npm client side. It broke for anyone who uses react router in this way.
I have a simple project I'm using this on that needed rapid development and initial features first. I load all my libraries client side from CDN in my index.html via script tags and skipped a complex build process client side to have faster go to market for the product for now.
Anyone else building a product who does the same is broken. I'm surprised a thousand people haven't reported the same issue. It's very obvious what changed. I just have no idea why. I'm new to react.
On Wed., Sep. 21, 2022, 12:41 a.m. Christian Bewernitz, < @.***> wrote:
I think I'm running into the same issue, so it should be reopened: When loading the umd builds for react-router and react-router-dom, they are trying to load the umd build for @remix-run/router, but I'm not able to find such a build. But this would be required in order to add it to my import map. (I tried to add both dist/router.js or dist/router.cjs.js but both obviously fail with syntax errors when they are loaded in the browser.)
When comparing the rollup configs for both packages, it looks like @remix-run/router doesn't produce a umd build.
(The history package that was a dependency until 6.3.0 did provide such a build.)
Until such a build is provided we are not able to upgrade.
— Reply to this email directly, view it on GitHub https://github.com/remix-run/react-router/issues/9240#issuecomment-1253196447, or unsubscribe https://github.com/notifications/unsubscribe-auth/AABDM5JL2SVWSIHODAETEG3V7KGWVANCNFSM6AAAAAAQLZFHFY . You are receiving this because you authored the thread.Message ID: @.***>
As far as i understand this has nothimg to do with react. You should be able to leave out any path and just use https://unpkg.com/[email protected] in the script tag, right? https://unpkg.com/[email protected] will not work since the newly added dependency doesn't seem to be configured for unpkg.
And I think not as many people are using "unpinned" versions on unpkg as you might expect, because it can blow up any time. And bundlers use a different loading mechanism, so they do not run into the issue.
Yes I agree it doesn't have anything to do with react for sure. Yes, I use @6.3 in the script tag now. if i change it to @6.4 everything breaks. Just that on its own is the problem I need to look into later but it is supposed to be a drop in replacement so I don't know why I'm getting a ton of errors.
You're most likely right about most people not using unpinned versions because it can blow up anytime. But it shouldn't blow up from 6.3 to 6.4 if it's a drop in.
On Wed, Sep 21, 2022 at 11:24 AM Christian Bewernitz < @.***> wrote:
As far as i understand this has nothimg to do with react. You should be able to leave out any path and just use @.*** in the script tag, right? @.*** will not work since the newly added dependency doesn't seem to be configured for unpkg.
And I think not as many people are using "unpinned" versions on unpkg as you might expect, because it can blow up any time. And bundlers use a different loading mechanism, so they do not run into the issue.
— Reply to this email directly, view it on GitHub https://github.com/remix-run/react-router/issues/9240#issuecomment-1253867155, or unsubscribe https://github.com/notifications/unsubscribe-auth/AABDM5KODVITFHXBGJ7TATTV7MSCBANCNFSM6AAAAAAQLZFHFY . You are receiving this because you authored the thread.Message ID: @.***>
There is also a dependency (@remix-run/router) in 6.4 that does not appear to have a UMD bundle associated with it. I discovered this once I updated my path to include the /dist.
Thanks for the details folks - I see the issue now - it's an oversight on our end. We specifically simplified the new @remix-run/router distribution given the modern landscape (and only included ESM/CJS but not UMD), but the nested react-router-dom UMD requirement for non-bundler loading was overlooked. I'm going to re-open this and see if we can just inline @remix-run/router in to the react-router-dom UMD bundle. Otherwise I guess we'll need to publish a UMD bundle for @remix-run/router after all.
Using ESM or a bundler will work today, but if you need to use unpkg I would hold off un upgrading to 6.4.0 until we get UMD support added.
Hey guys, any updates on this? I need to use unpkg as well and this is preventing us from using the new 6.4 features :(
Hey folks, this is on my radar this week with a few other things. Hoping to package them in a 6.4.3 prerelease this week and get a stable out next week.
👋 Just did a prerelease (6.4.3-pre.0) which should fix this if you want to give it a shot!
The UMD build for @remix-run/router` is at: https://unpkg.com/@remix-run/[email protected]/dist/router.umd.min.js
Closing this with the stable 6.4.3 release - please let us know if you still run into any issues!