Skip to content

Commit f309859

Browse files
committed
fix: escape vite asset import suffixes
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
1 parent 6963bfb commit f309859

File tree

3 files changed

+10
-0
lines changed

3 files changed

+10
-0
lines changed

examples/node/app/routes/_index.tsx

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import type { LoaderFunctionArgs } from '@remix-run/node'
22
import { useLoaderData } from '@remix-run/react'
3+
import logoDark from '/logo-dark.png?inline'
34

45
export const loader = (args: LoaderFunctionArgs) => {
56
const extra = args.context.extra
@@ -14,6 +15,12 @@ export default function Index() {
1415
<h1>Remix and Hono</h1>
1516
<h2>URL is {url}</h2>
1617
<h3>Extra is {extra}</h3>
18+
<div >
19+
<img
20+
src={logoDark}
21+
alt="Remix"
22+
/>
23+
</div>
1724
</div>
1825
)
1926
}

examples/node/public/logo-dark.png

78.4 KB
Loading

src/vite-plugin.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,9 @@ export default (options: Options): Plugin => {
3131
'/assets/**',
3232
'/app/**',
3333
'/src/app/**',
34+
// matches for vite's import assets suffixes
35+
/\?(import(&)?)?(inline|url|no-inline|raw)?$/
36+
3437
],
3538
injectClientScript: false,
3639
loadModule: async (server, entry) => {

0 commit comments

Comments
 (0)