diff --git a/packages/cli/src/config/rollup.config.js b/packages/cli/src/config/rollup.config.js index b0ea175c9..e9103edc9 100644 --- a/packages/cli/src/config/rollup.config.js +++ b/packages/cli/src/config/rollup.config.js @@ -400,8 +400,8 @@ const getRollupConfigForSsr = async (compilation, input) => { input: filepath, output: { dir: normalizePathnameForWindows(outputDir), - entryFileNames: '[name].route.js', - chunkFileNames: '[name].route.chunk.[hash].js' + entryFileNames: `${path.basename(filepath).split('.')[0]}.route.js`, + chunkFileNames: `${path.basename(filepath).split('.')[0]}.route.chunk.[hash].js` }, plugins: [ greenwoodResourceLoader(compilation), diff --git a/packages/plugin-adapter-netlify/src/index.js b/packages/plugin-adapter-netlify/src/index.js index 15ffbf0aa..d874f2d65 100644 --- a/packages/plugin-adapter-netlify/src/index.js +++ b/packages/plugin-adapter-netlify/src/index.js @@ -97,8 +97,8 @@ async function netlifyAdapter(compilation) { const { id } = page; const outputType = 'page'; const outputRoot = new URL(`./${id}/`, adapterOutputUrl); - const files = (await fs.readdir(outputDir)) - .filter(file => file.startsWith(`${id}.route.chunk.`) && file.endsWith('.js')); + const chunks = (await fs.readdir(outputDir)) + .filter(file => file.startsWith(`${id}.route.chunk`) && file.endsWith('.js')); await setupOutputDirectory(id, outputRoot, outputType); @@ -109,11 +109,11 @@ async function netlifyAdapter(compilation) { { recursive: true } ); - // and the URL chunk for renderer plugin and executeRouteModule - for (const file of files) { + // and any (URL) chunks for the page + for (const chunk of chunks) { await fs.cp( - new URL(`./${file}`, outputDir), - new URL(`./${file}`, outputRoot), + new URL(`./${chunk}`, outputDir), + new URL(`./${chunk}`, outputRoot), { recursive: true } ); } diff --git a/packages/plugin-adapter-vercel/src/index.js b/packages/plugin-adapter-vercel/src/index.js index f37e8154c..0353e2fa5 100644 --- a/packages/plugin-adapter-vercel/src/index.js +++ b/packages/plugin-adapter-vercel/src/index.js @@ -86,8 +86,8 @@ async function vercelAdapter(compilation) { const outputType = 'page'; const { id } = page; const outputRoot = new URL(`./${basePath}/${id}.func/`, adapterOutputUrl); - const files = (await fs.readdir(outputDir)) - .filter(file => file.startsWith(`${id}.route.chunk.`) && file.endsWith('.js')); + const chunks = (await fs.readdir(outputDir)) + .filter(file => file.startsWith(`${id}.route.chunk`) && file.endsWith('.js')); await setupFunctionBuildFolder(id, outputType, outputRoot); @@ -98,11 +98,11 @@ async function vercelAdapter(compilation) { { recursive: true } ); - // and the URL chunk for renderer plugin and executeRouteModule - for (const file of files) { + // and any (URL) chunks for the page + for (const chunk of chunks) { await fs.cp( - new URL(`./${file}`, outputDir), - new URL(`./${file}`, outputRoot), + new URL(`./${chunk}`, outputDir), + new URL(`./${chunk}`, outputRoot), { recursive: true } ); }