Skip to content

Commit

Permalink
Remove unused 'preconnect' property
Browse files Browse the repository at this point in the history
  • Loading branch information
theninthsky committed Jan 11, 2025
1 parent 4fefec2 commit 1a3f0bd
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
7 changes: 3 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ An in-depth comparison of all rendering methods can be found on this project's _
- [Preloading Async Pages](#preloading-async-pages)
- [Splitting Async Vendors](#splitting-async-vendors)
- [Preloading Data](#preloading-data)
- [Preloading Next Pages Data](#preloading-other-pages-data)
- [Preloading Next Pages Data](#preloading-next-pages-data)
- [Precaching](#precaching)
- [Adaptive Source Inlining](#adaptive-source-inlining)
- [Leveraging the 304 Status Code](#leveraging-the-304-status-code)
Expand Down Expand Up @@ -447,11 +447,11 @@ _[scripts/inject-assets-plugin.js](scripts/inject-assets-plugin.js)_
```diff
const getPages = rawAssets => {
- const pages = Object.entries(pagesManifest).map(([chunk, { path, title }]) => {
+ const pages = Object.entries(pagesManifest).map(([chunk, { path, title, data, preconnect }]) => {
+ const pages = Object.entries(pagesManifest).map(([chunk, { path, title, data }]) => {
const scripts = rawAssets.filter(name => new RegExp(`[/.]${chunk}\\.(.+)\\.js$`).test(name))

- return { path, title, script }
+ return { path, title, scripts, data, preconnect }
+ return { path, title, scripts, data }
})

return pages
Expand Down Expand Up @@ -512,7 +512,6 @@ const preloadData = ({ pathname = getPathname(), path, data }) => {
fetch(constructedURL, { ...request, preload: true })
// https://issues.chromium.org/issues/380896837
preconnect?.forEach(url => {
document.head.appendChild(Object.assign(document.createElement('link'), { rel: 'preconnect', href: url }))
})
Expand Down
4 changes: 2 additions & 2 deletions scripts/inject-assets-plugin.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@ import pagesManifest from '../src/pages.js'
const __dirname = import.meta.dirname

const getPages = rawAssets => {
const pages = Object.entries(pagesManifest).map(([chunk, { path, title, data, preconnect }]) => {
const pages = Object.entries(pagesManifest).map(([chunk, { path, title, data }]) => {
const scripts = rawAssets.map(({ name }) => name).filter(name => new RegExp(`[/.]${chunk}\\.(.+)\\.js$`).test(name))

return { path, scripts, title, data, preconnect }
return { path, scripts, title, data }
})

return pages
Expand Down

0 comments on commit 1a3f0bd

Please sign in to comment.