fix(vite): asset handling (#3225)
This PR reworks asset handling in our vite plugin. Importing assets in js is now supported.
This commit is contained in:
@@ -19,6 +19,7 @@ export interface BuildSnapshot<State> {
|
||||
fsRoutes: FsRouteFile<State>[];
|
||||
staticFiles: Map<string, FileSnapshot>;
|
||||
islands: ServerIslandRegistry;
|
||||
entryAssets: string[];
|
||||
}
|
||||
|
||||
export interface StaticFile {
|
||||
@@ -39,6 +40,7 @@ export interface BuildCache<State = any> {
|
||||
};
|
||||
getFsRoutes(): Command<State>[];
|
||||
readFile(pathname: string): Promise<StaticFile | null>;
|
||||
getEntryAssets(): string[];
|
||||
}
|
||||
|
||||
export class ProdBuildCache<State> implements BuildCache<State> {
|
||||
@@ -54,6 +56,10 @@ export class ProdBuildCache<State> implements BuildCache<State> {
|
||||
this.clientEntry = snapshot.clientEntry;
|
||||
}
|
||||
|
||||
getEntryAssets(): string[] {
|
||||
return this.#snapshot.entryAssets;
|
||||
}
|
||||
|
||||
getFsRoutes(): Command<State>[] {
|
||||
return fsItemsToCommands(this.#snapshot.fsRoutes);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user