Skip to content

Commit d18d280

Browse files
authored
docs(readme): add "Change the client entry point" (#14)
1 parent 1317c02 commit d18d280

File tree

1 file changed

+39
-0
lines changed

1 file changed

+39
-0
lines changed

README.md

+39
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,45 @@ export const renderer = reactRenderer(({ children }) => {
7777
})
7878
```
7979

80+
## Guides
81+
82+
### Change the client entry point
83+
84+
If you want to change the path of the client entry point, add a `src` attribute to the `Script` component and set the path.
85+
86+
```tsx
87+
// src/client/main.tsx
88+
import { Script, Link } from 'hono-vite-react-stack/components'
89+
90+
export const renderer = reactRenderer(({ children }) => {
91+
return (
92+
<html>
93+
<head>
94+
{/** Add src attribute to Script component */}
95+
<Script src='/src/client/main.tsx' />
96+
</head>
97+
<body>{children}</body>
98+
</html>
99+
)
100+
})
101+
```
102+
103+
For the build, you can specify it in the `vite.config.ts`.
104+
105+
```ts
106+
// vite.config.ts
107+
import reactStack from 'hono-vite-react-stack'
108+
import { defineConfig } from 'vite'
109+
110+
export default defineConfig({
111+
plugins: [
112+
reactStack({
113+
clientEntry: './src/client/main.tsx',
114+
}),
115+
],
116+
})
117+
```
118+
80119
## Example Project
81120

82121
Directory structure:

0 commit comments

Comments
 (0)