Skip to content

Commit

Permalink
Merge branch 'dev' into issue-9844_fix-injection-of-inline-and-raw-cs…
Browse files Browse the repository at this point in the history
…s-files
  • Loading branch information
markdalgleish authored Sep 16, 2024
2 parents 2e9bea0 + 825f70e commit 0c4dc93
Show file tree
Hide file tree
Showing 78 changed files with 3,500 additions and 1,343 deletions.
5 changes: 0 additions & 5 deletions .changeset/dirty-adults-sparkle.md

This file was deleted.

5 changes: 5 additions & 0 deletions .changeset/hungry-experts-suffer.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@remix-run/dev": patch
---

Properly abort `request.signal` during `vite dev` when the node response is closed
14 changes: 0 additions & 14 deletions .changeset/khaki-ads-buy.md

This file was deleted.

5 changes: 0 additions & 5 deletions .changeset/popular-meals-hide.md

This file was deleted.

8 changes: 8 additions & 0 deletions .changeset/tender-pears-confess.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
"@remix-run/cloudflare": patch
"@remix-run/deno": patch
"@remix-run/node": patch
"@remix-run/server-runtime": patch
---

Single Fetch: Re-export `interface Future` through `@remix-run/node`/`@remix-run/cloudflare`/`@remix-run/deno` packages so that `pnpm` doesn't complain about `@remix-run/server-runtime` not being a dependency
5 changes: 0 additions & 5 deletions .changeset/tiny-crabs-deliver.md

This file was deleted.

5 changes: 0 additions & 5 deletions .changeset/two-chicken-provide.md

This file was deleted.

232 changes: 168 additions & 64 deletions CHANGELOG.md

Large diffs are not rendered by default.

4 changes: 4 additions & 0 deletions contributors.yml
Original file line number Diff line number Diff line change
Expand Up @@ -367,6 +367,7 @@
- kishanhitk
- kiyadotdev
- klauspaiva
- klirium
- knowler
- konradkalemba
- krolebord
Expand Down Expand Up @@ -485,6 +486,7 @@
- n8agrin
- na2hiro
- nareshbhatia
- nauvalazhar
- naveed-fida
- navid-kalaei
- nexxeln
Expand All @@ -504,6 +506,7 @@
- niwsa
- nobeeakon
- nordiauwu
- nornagon
- not-ivy
- npapagna
- nrako
Expand Down Expand Up @@ -547,6 +550,7 @@
- remix-run-bot
- richardhunghhw
- riencoertjens
- risv1
- rkulinski
- rlfarman
- roachjc
Expand Down
2 changes: 1 addition & 1 deletion docs/file-conventions/routes.md
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ Sometimes you want to share a layout with a group of routes without adding any p
| `/` | `app/routes/_index.tsx` | `app/root.tsx` |
| `/login` | `app/routes/_auth.login.tsx` | `app/routes/_auth.tsx` |
| `/register` | `app/routes/_auth.register.tsx` | `app/routes/_auth.tsx` |
| `/concerts` | `app/routes/concerts.tsx` | `app/routes/concerts.tsx` |
| `/concerts` | `app/routes/concerts.tsx` | `app/root.tsx` |
| `/concerts/salt-lake-city` | `app/routes/concerts.$city.tsx` | `app/routes/concerts.tsx` |

Think of the `_leading` underscore as a blanket you're pulling over the filename, hiding the filename from the URL.
Expand Down
68 changes: 68 additions & 0 deletions docs/guides/dependency-optimization.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
---
title: Dependency optimization
---

<docs-info>This feature only affects development. It does not impact production builds.</docs-info>

# Dependency optimization

Remix introduced automatic dependency optimization in development behind the `future.unstable_optimizeDeps` [Future Flag][future-flags].
This allows you to opt-into this behavior which will become the default in the next major version of Remix - a.k.a. React Router v7 ([1][rr-v7], [2][rr-v7-2]).

In development, Vite aims to [prebundle dependencies][prebundle-dependencies] so that it can efficiently serve up those dependencies on-demand.
To do this, Vite needs to know where to start crawling your app's module graph to look for dependencies.

Previously, Remix did not inform Vite to start dependency detection at route modules nor at the client entry.
That meant that in development, Vite would encounter new dependencies as you navigated around in your app resulting in `504 Outdated Dependency` errors.
Consequently, the development experience could feel janky at times since those errors could cause HMR to break or link navigations to be aborted.
Navigation could also feel sluggish as processing dependencies interactively could sometimes be slow.

For more information, see [Vite's Dep Optimization Options][vite-s-dep-optimization-options].

## Troubleshooting

### `Failed to resolve entry for package`

```txt
✘ [ERROR] Failed to resolve entry for package "<package>". The package may have incorrect main/module/exports specified in its package.json. [plugin vite:dep-pre-bundle]
```

This is usually caused by a misconfigured dependency.
You use [publint][publint] to check if the offending package is misconfigured.
To fix the issue, you'll need to use `npm why` or `pnpm why` to determine which of your direct dependencies to add to `optimizeDeps.exclude`.

For example, let's say your app is running into this error:

```txt
✘ [ERROR] Failed to resolve entry for package "jimp". The package may have incorrect main/module/exports specified in its package.json. [plugin vite:dep-pre-bundle]
```

Sure enough, `publint` reports that the [`jimp` package is misconfigured][jimp-package-is-misconfigured].
Then, you determine that `jimp` is an indirect dependency being pulled in by your `svg2img` direct dependency:

```sh
❯ npm why jimp
jimp@0.16.13
node_modules/jimp
jimp@"^0.16.1" from svg2img@1.0.0-beta.2
node_modules/svg2img
svg2img@"^1.0.0-beta.2" from the root project
```

Finally, you add `svg2img` to `optimizeDeps.exclude`, which should fix the issue:

```ts filename=vite.config.ts
export default defineConfig({
optimizeDeps: {
exclude: ["svg2img"],
},
});
```

[future-flags]: ../guides/api-development-strategy
[rr-v7]: https://remix.run/blog/merging-remix-and-react-router
[rr-v7-2]: https://remix.run/blog/incremental-path-to-react-19
[prebundle-dependencies]: https://vitejs.dev/guide/dep-pre-bundling.html
[vite-s-dep-optimization-options]: https://vitejs.dev/config/dep-optimization-options#dep-optimization-options
[publint]: https://publint.dev
[jimp-package-is-misconfigured]: https://publint.dev/jimp@0.22.12
Loading

0 comments on commit 0c4dc93

Please sign in to comment.