Skip to content

Commit

Permalink
fix: escape vite asset import suffixes
Browse files Browse the repository at this point in the history
Add the regix to exclude all vite asset import suffixes,
might be better done in the @hono/vite-dev-server, but this
fixes the issue for now
  • Loading branch information
barakcodes committed Dec 3, 2024
1 parent 6963bfb commit cb85414
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 0 deletions.
7 changes: 7 additions & 0 deletions examples/node/app/routes/_index.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import type { LoaderFunctionArgs } from '@remix-run/node'
import { useLoaderData } from '@remix-run/react'
import logoDark from '/logo-dark.png?inline'

export const loader = (args: LoaderFunctionArgs) => {
const extra = args.context.extra
Expand All @@ -14,6 +15,12 @@ export default function Index() {
<h1>Remix and Hono</h1>
<h2>URL is {url}</h2>
<h3>Extra is {extra}</h3>
<div >
<img
src={logoDark}
alt="Remix"
/>
</div>
</div>
)
}
Binary file added examples/node/public/logo-dark.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 2 additions & 0 deletions src/vite-plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ export default (options: Options): Plugin => {
'/assets/**',
'/app/**',
'/src/app/**',
// matches for vite's import assets suffixes
/\?(inline|url|no-inline|raw)/,
],
injectClientScript: false,
loadModule: async (server, entry) => {
Expand Down

0 comments on commit cb85414

Please sign in to comment.