@@ -5,7 +5,12 @@ import fg from 'fast-glob';
55import mm from 'micromatch' ;
66import { Entry , UserConfig , UserEntryConfigItem } from './types' ;
77import { flattenPath , normalizeRoutePath , toArray } from './utils' ;
8- import { DEFAULT_ENTRY_MODULE_ID , DEFAULT_HTML_PATH } from './constants' ;
8+ import {
9+ DEFAULT_ENTRY_MODULE_ID ,
10+ DEFAULT_HTML_PATH ,
11+ ENTRIES_MODULE_ID ,
12+ RESOLVED_ENTRIES_MODULE_ID ,
13+ } from './constants' ;
914import {
1015 minifyHtml ,
1116 prettifyHtml ,
@@ -15,7 +20,11 @@ import {
1520
1621export * from './types' ;
1722
18- export { DEFAULT_ENTRY_MODULE_ID } ;
23+ export {
24+ DEFAULT_ENTRY_MODULE_ID ,
25+ ENTRIES_MODULE_ID ,
26+ RESOLVED_ENTRIES_MODULE_ID ,
27+ } ;
1928
2029function getHtmlOutDir ( root : string ) {
2130 const nodeModulesDir = path . resolve ( root , 'node_modules' ) ;
@@ -181,7 +190,12 @@ export function conventionalEntries(userConfig: UserConfig = {}): Plugin[] {
181190 entries : userEntries . flatMap ( ( { dir, pattern } ) =>
182191 toArray ( pattern ) . map ( p => `${ path . relative ( root , dir ) } /${ p } ` )
183192 ) ,
184- include : [ 'react' , 'react-dom/client' ] ,
193+ include : [
194+ 'react' ,
195+ 'react/jsx-runtime' ,
196+ 'react/jsx-dev-runtime' ,
197+ 'react-dom/client' ,
198+ ] ,
185199 } ,
186200 build : {
187201 rollupOptions : {
@@ -301,6 +315,21 @@ if (rootEl) {
301315 }
302316 } ,
303317 } ,
318+ {
319+ name : 'vite-plugin-conventional-entries:expose-entries' ,
320+ resolveId ( source ) {
321+ if ( source === ENTRIES_MODULE_ID ) {
322+ return RESOLVED_ENTRIES_MODULE_ID ;
323+ }
324+ } ,
325+ load ( id ) {
326+ if ( id === RESOLVED_ENTRIES_MODULE_ID ) {
327+ return `export const entries = ${ JSON . stringify ( entries , null , 2 ) } ;
328+ export default entries;
329+ ` ;
330+ }
331+ } ,
332+ } ,
304333 ] ;
305334}
306335
0 commit comments