@@ -16,11 +16,7 @@ import {
1616 normalizePath ,
1717} from "vite" ;
1818import type { ImportAssetsOptions , ImportAssetsResult } from "../types/shared" ;
19- import {
20- type AssetsVirtual ,
21- parseAssetsVirtual ,
22- toAssetsVirtual ,
23- } from "./plugins/shared" ;
19+ import { parseAssetsVirtual , toAssetsVirtual } from "./plugins/shared" ;
2420import {
2521 createVirtualPlugin ,
2622 getEntrySource ,
@@ -48,7 +44,7 @@ type ImportAssetsMeta = {
4844 id : string ;
4945 key : string ;
5046 importerEnvironment : string ;
51- virtual : AssetsVirtual ;
47+ entry : boolean ;
5248} ;
5349
5450export default function vitePluginFullstack (
@@ -274,15 +270,17 @@ export function assetsPlugin(pluginOpts?: FullstackPluginOptions): Plugin[] {
274270 }
275271 return `export default ${ JSON . stringify ( result ) } ` ;
276272 } else {
273+ const id = resolved . id ;
274+ const map = ( importAssetsMetaMap [ parsed . environment ] ??= { } ) ;
277275 const meta : ImportAssetsMeta = {
278- id : resolved . id ,
279- // normalize to have machine-independent build output
276+ id,
277+ // normalize key to have machine-independent build output
280278 key : path . relative ( resolvedConfig . root , resolved . id ) ,
281279 importerEnvironment : this . environment . name ,
282- virtual : parsed ,
280+ // merge `entry`
281+ entry : map [ id ] ?. entry || ! ! parsed . entry ,
283282 } ;
284- // TODO: don't overwrite entry=true to entry=false
285- ( importAssetsMetaMap [ parsed . environment ] ??= { } ) [ meta . id ] = meta ;
283+ map [ id ] = meta ;
286284 return `\
287285 import __assets_manifest from "virtual:fullstack/assets-manifest";
288286 export default __assets_manifest[${ JSON . stringify ( parsed . environment ) } ][${ JSON . stringify ( meta . key ) } ];
@@ -319,7 +317,7 @@ export function assetsPlugin(pluginOpts?: FullstackPluginOptions): Plugin[] {
319317 const metas = importAssetsMetaMap [ "client" ] ;
320318 if ( metas ) {
321319 for ( const meta of Object . values ( importAssetsMetaMap [ "client" ] ! ) ) {
322- if ( meta . virtual . entry ) {
320+ if ( meta . entry ) {
323321 this . emitFile ( {
324322 type : "chunk" ,
325323 id : meta . id ,
0 commit comments