Skip to content

Commit ce7dffa

Browse files
committed
fix: Support custom output names/paths
1 parent 6ed657c commit ce7dffa

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/plugins/prerender-plugin.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -303,8 +303,10 @@ export function prerenderPlugin({ prerenderScript, renderTarget, additionalPrere
303303
for (const output of Object.keys(bundle)) {
304304
if (!output.endsWith('.js') || bundle[output].type !== 'chunk') continue;
305305

306+
const assetPath = path.join(tmpDir, output);
307+
await fs.mkdir(path.dirname(assetPath), { recursive: true });
306308
await fs.writeFile(
307-
path.join(tmpDir, path.basename(output)),
309+
assetPath,
308310
/** @type {OutputChunk} */ (bundle[output]).code,
309311
);
310312

@@ -372,7 +374,7 @@ export function prerenderPlugin({ prerenderScript, renderTarget, additionalPrere
372374
let prerender;
373375
try {
374376
const m = await import(
375-
`file://${path.join(tmpDir, path.basename(prerenderEntry.fileName))}`
377+
`file://${path.join(tmpDir, prerenderEntry.fileName)}`
376378
);
377379
prerender = m.prerender;
378380
} catch (e) {

0 commit comments

Comments
 (0)