Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: 6.4 release changed folder structure? UNPKG links broke a few minutes ago #9240

Closed
dhodgin opened this issue Sep 13, 2022 · 13 comments · Fixed by #9446
Closed

[Bug]: 6.4 release changed folder structure? UNPKG links broke a few minutes ago #9240

dhodgin opened this issue Sep 13, 2022 · 13 comments · Fixed by #9446
Labels

Comments

@dhodgin
Copy link

dhodgin commented Sep 13, 2022

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

@dhodgin dhodgin added the bug label Sep 13, 2022
@brophdawg11
Copy link
Contributor

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.

@dhodgin
Copy link
Author

dhodgin commented Sep 13, 2022

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.

@brophdawg11
Copy link
Contributor

ok - please file any issues you find - it should be non-breaking for current 6.3.0 apps

@karfau
Copy link

karfau commented Sep 21, 2022

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.

@dhodgin
Copy link
Author

dhodgin commented Sep 21, 2022 via email

@karfau
Copy link

karfau commented Sep 21, 2022

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/react-router@6.3 in the script tag, right?
https://unpkg.com/react-router@6.4 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.

@dhodgin
Copy link
Author

dhodgin commented Sep 21, 2022 via email

@moderndegree
Copy link

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.

@brophdawg11
Copy link
Contributor

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.

@brophdawg11 brophdawg11 reopened this Sep 22, 2022
@tomerzcod7
Copy link

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 :(

@brophdawg11
Copy link
Contributor

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.

@brophdawg11
Copy link
Contributor

👋 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/router@1.0.3-pre.0/dist/router.umd.min.js

@brophdawg11
Copy link
Contributor

Closing this with the stable 6.4.3 release - please let us know if you still run into any issues!

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

Successfully merging a pull request may close this issue.

5 participants