We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 7a40ee7 commit 2383c75Copy full SHA for 2383c75
packages/plugin-rsc/examples/basic/vite.config.ts
@@ -23,6 +23,7 @@ export default defineConfig({
23
tailwindcss(),
24
react(),
25
vitePluginUseCache(),
26
+ vitePluginBrowserOnly(),
27
rsc({
28
entries: {
29
client: './src/client.tsx',
@@ -176,3 +177,18 @@ function vitePluginUseCache(): Plugin[] {
176
177
},
178
]
179
}
180
+
181
+function vitePluginBrowserOnly(): Plugin[] {
182
+ return [
183
+ {
184
+ name: 'browser-only-component',
185
+ load(id: string) {
186
+ if (id.endsWith('?browser-only')) {
187
+ this.environment.name === 'ssr'
188
+ this.environment.name === 'rsc'
189
+ this.environment.name === 'client'
190
+ }
191
+ },
192
193
+ ]
194
+}
0 commit comments