Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion src/generators/web/utils/bundle.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,10 @@ export default async function bundleCode(codeMap, { server = false } = {}) {
resolve: {
// Alias react imports to preact/compat for smaller bundle sizes.
// Explicit jsx-runtime aliases are required for the automatic JSX transform.
alias: { react: 'preact/compat' },
alias: {
react: 'preact/compat',
'react-dom': 'preact/compat',
Copy link

Copilot AI Dec 11, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The comment on line 86 states that "Explicit jsx-runtime aliases are required for the automatic JSX transform," but the jsx-runtime aliases are missing from the configuration. When using the automatic JSX runtime (configured on line 80 as 'react-jsx'), the bundler will attempt to import from 'react/jsx-runtime' and 'react/jsx-dev-runtime'. These should be aliased to their Preact equivalents for the configuration to work correctly. Consider adding:

  • 'react/jsx-runtime': 'preact/jsx-runtime'
  • 'react/jsx-dev-runtime': 'preact/jsx-dev-runtime'
Suggested change
'react-dom': 'preact/compat',
'react-dom': 'preact/compat',
'react/jsx-runtime': 'preact/jsx-runtime',
'react/jsx-dev-runtime': 'preact/jsx-dev-runtime',

Copilot uses AI. Check for mistakes.
},

// Tell the bundler where to find node_modules.
// This ensures packages are found when running doc-kit from external directories
Expand Down
Loading