Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build break by missing file or directory react/jsx-runtime?inside-island #152

Closed
jonasnobile opened this issue Apr 16, 2024 · 1 comment · Fixed by #153
Closed

Build break by missing file or directory react/jsx-runtime?inside-island #152

jonasnobile opened this issue Apr 16, 2024 · 1 comment · Fixed by #153
Labels
bug Something isn't working

Comments

@jonasnobile
Copy link

What version of HonoX are you using?

0.1.14

What steps can reproduce the bug?

  • use React renderer
  • have some inside islands
  • run build

vite.config.js

import pages from '@hono/vite-cloudflare-pages'
import honox from 'honox/vite'
import client from 'honox/vite/client'
import { defineConfig } from 'vite'

export default defineConfig(({ mode }) => {
	if (mode === 'client') {
		return {
			build: {
				rollupOptions: {
					input: ['./app/client.ts', './app/style.css'],
					output: {
						entryFileNames: 'static/client.js',
						chunkFileNames: 'static/assets/[name]-[hash].js',
						assetFileNames: 'static/assets/[name].[ext]',
					},
				},
				emptyOutDir: false,
			},
			plugins: [client()],
		}
	} else {
		return {
			ssr: {
				external: ['react', 'react-dom'],
			},
			plugins: [honox(), pages()],
		}
	}
})

What is the expected behavior?

Build application without error.

What do you see instead?

error during build:
Error: [vite:load-fallback] Could not load react/jsx-runtime?inside-island (imported by app/islands/episode-list.tsx): ENOENT: no such file or directory, open 'react/jsx-runtime?inside-island'

Additional information

No response

@yusukebe
Copy link
Member

Hi @jonasnobile

This is fixed with the new version 0.1.15. Try it!

And if you want to build React, you have to specify jsxImportSource like the following:

export default defineConfig(({ mode }) => {
  if (mode === 'client') {
    return {
      // ...
      plugins: [
        client({
          jsxImportSource: 'react', // <--- Add
        }),
      ],
    }
  } else {
    return {
      ssr: {
        external: ['react', 'react-dom'],
      },
      plugins: [honox(), pages()],
    }
  }
})

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants