-
-
Notifications
You must be signed in to change notification settings - Fork 10.6k
Remove hashes on built filenames #13567
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
Conversation
🦋 Changeset detectedLatest commit: 893f9cc The changes in this PR will be included in the next version bump. This PR includes changesets to release 11 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
8ccf566
to
daf7534
Compare
packages/react-router/tsup.config.ts
Outdated
...config("index.ts", false), | ||
...config("index.ts", true), | ||
...config("dom-export.ts", false), | ||
...config("dom-export.ts", true), | ||
...config("lib/types/internal.ts", false), | ||
...config("lib/types/internal.ts", true), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does having separate bundle configs create unique files for each bundle? ie. if two bundles depend on the same source file, does each bundle get its own copy? I remember something like that happening before and unifying the entries into a single config fixed it, but I could be misremembering
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It does but the external
config lets us avoid that. Without external: ['react-router']
it would dup the react router code in index
and dom-export
, but using that config, dom-export
just does import {} from 'react-router'
and it resolves through to the index
file.
@pcattori I think there is still a type issue here from the |
This reverts commit 7ad3bed.
d31f45f
to
d8b4226
Compare
@@ -277,7 +277,7 @@ export type { | |||
MiddlewareEnabled as UNSAFE_MiddlewareEnabled, | |||
} from "./lib/types/future.ts"; | |||
export type { unstable_SerializesTo } from "./lib/types/serializes-to.ts"; | |||
export type { Register } from "./lib/types/register"; | |||
export type { Register, Pages, RouteFiles } from "./lib/types/register"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Now exported as public API from react-router
for consumption by react-router/internal
params: Params<T["file"]>; | ||
loaderData: GetLoaderData<T["module"]>; | ||
actionData: GetActionData<T["module"]>; | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lifted to the root to align with our dom-export.ts
file
@@ -172,7 +172,7 @@ test.describe("prefetch", () => { | |||
await page.waitForSelector( | |||
// Look for either Rollup or Rolldown chunks | |||
[ | |||
"link[rel='modulepreload'][href^='/assets/chunk-']", | |||
"link[rel='modulepreload'][href^='/assets/index-']", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I confirmed this is just a rename of a dist file but the contents are the same - it's the built file containing react and react router:
# Old:
vite v6.1.1 building for production...
✓ 44 modules transformed.
build/client/.vite/manifest.json 1.97 kB │ gzip: 0.40 kB
build/client/assets/_index-CIzFY5VO.js 0.20 kB │ gzip: 0.18 kB
build/client/assets/prefetch-with-loader-DSdeOoqs.js 0.21 kB │ gzip: 0.19 kB
build/client/assets/prefetch-without-loader-RubElpnG.js 0.22 kB │ gzip: 0.19 kB
build/client/assets/with-props-Cx2GuqjJ.js 0.22 kB │ gzip: 0.19 kB
build/client/assets/root-BX6sQn4U.js 0.73 kB │ gzip: 0.38 kB
build/client/assets/chunk-23TDSFDP-DRRB-IEc.js 131.31 kB │ gzip: 43.82 kB 👈
build/client/assets/entry.client-Dsu8FA8V.js 339.28 kB │ gzip: 101.90 kB
# New
vite v6.1.1 building for production...
✓ 43 modules transformed.
build/client/.vite/manifest.json 1.89 kB │ gzip: 0.38 kB
build/client/assets/_index-P-ZakiLo.js 0.19 kB │ gzip: 0.17 kB
build/client/assets/prefetch-with-loader-COazqWjd.js 0.20 kB │ gzip: 0.18 kB
build/client/assets/prefetch-without-loader-CD33gy26.js 0.21 kB │ gzip: 0.18 kB
build/client/assets/with-props-06UYi0rd.js 0.21 kB │ gzip: 0.18 kB
build/client/assets/root-C717KEjd.js 0.72 kB │ gzip: 0.37 kB
build/client/assets/index-DRRB-IEc.js 131.31 kB │ gzip: 43.82 kB 👈
build/client/assets/entry.client-B9qJACK4.js 339.27 kB │ gzip: 101.88 kB
@@ -94,7 +94,7 @@ import { | |||
useResolvedPath, | |||
useRouteId, | |||
} from "../hooks"; | |||
import type { SerializeFrom } from "../types/route-data"; | |||
import type { SerializeFrom } from "../types/internal-export/route-data"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@pcattori It looks like we have some circular deps here which are probably fine but it might be something we look into cleaning up later? react-router/internal
imports RouteFiles
from react-router
so it doesn't seem like react-router
should reach back into /internal
stuff?
It looks like the underlying shared thing is ServerDataFrom
/ClientDataFrom
so maybe they should be exported as UNSAFE_
from react-router
and pulled into /internal
that way alongside RouteFiles
?
@@ -1,12 +1,12 @@ | |||
import type { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Anything directly exported from internal-export.ts
now lives in the types/internal-export/
folder
🤖 Hello there, We just published version Thanks! |
This reverts commit a105445.
This reverts commit a105445.
🤖 Hello there, We just published version Thanks! |
Only done for the RR package currently but can adopt in the other packages if this is the way to go
I'm pretty sure we got the extracted (and hashed) chunk before because we built
index.ts
anddom-export.ts
in the same config. It then extracted the shared code (all ofindex.ts
) into a chunk.By giving these to
tsup
in different configs, it doesn't identify that code as shared and doesn't extract to a chunk. And by markingreact-router
asexternal
it causes the dom exports to justrequire
/import
it correctly and not bundle it.The output with this config looks like:
Alternate approach:
I also tried a simpler approach of using
splitting: false
withexternal: ['react-router']
(see 7ad3bed) but that still generates some hashed files. However - I don't think we get the typegen E2E test failures with this config so unsure what the difference is there yet.