Skip to content

Commit

Permalink
fix(dev): serve svgs from dev server without errors
Browse files Browse the repository at this point in the history
  • Loading branch information
pcattori committed May 2, 2023
1 parent 0abd360 commit 89f68b2
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
6 changes: 3 additions & 3 deletions .changeset/ninety-flies-allow.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@
"@remix-run/dev": patch
---

Fix public asset serving for non-Remix assets in the new dev server

Also, add `--public-directory` / `unstable_dev.publicDirectory` option for configuring local directory for serving non-Remix assets like fonts
- Fix public asset serving for non-Remix assets in the new dev server
- Add `--public-directory` / `unstable_dev.publicDirectory` option for configuring local directory for serving non-Remix assets like fonts
- Fix `svg` serving for new dev server
6 changes: 5 additions & 1 deletion packages/remix-dev/compiler/js/compiler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,11 @@ const createEsbuildConfig = (
platform: "browser",
format: "esm",
external: getExternals(ctx.config),
loader: loaders,
loader: {
...loaders,
// in development, use dataurls for svgs so that `<use href={mysvg} />` works across different origins
".svg": ctx.options.mode === "development" ? "dataurl" : loaders[".svg"],
},
bundle: true,
logLevel: "silent",
splitting: true,
Expand Down

0 comments on commit 89f68b2

Please sign in to comment.