Skip to content

Commit

Permalink
fix: ssr inline
Browse files Browse the repository at this point in the history
  • Loading branch information
GiveMe-A-Name committed Nov 3, 2023
1 parent d1d8e04 commit eafc95a
Showing 1 changed file with 3 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,9 @@ const readAsset = async (chunk: ChunkAsset) => {
const fs = await import('node:fs/promises');
const path = await import('node:path');

let filepath: string;
if (process.env.NODE_ENV === 'production') {
filepath = path.resolve(__dirname, chunk.filename!);
} else {
filepath = chunk.path!;
}
// only working in 'production' env
// we need ensure the assetsDir is same as ssr bundles.
const filepath = path.resolve(__dirname, chunk.filename!);

return fs.readFile(filepath, 'utf-8');
};
Expand Down

0 comments on commit eafc95a

Please sign in to comment.