Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bug/issue 1118 SSR pages are missing URL chunks of route chunk #1210

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions packages/cli/src/config/rollup.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,7 @@
}
}
} else {
// TODO figure out how to handle URL chunk from SSR pages

Check warning on line 262 in packages/cli/src/config/rollup.config.js

View workflow job for this annotation

GitHub Actions / build (18)

Unexpected 'todo' comment: 'TODO figure out how to handle URL chunk...'

Check warning on line 262 in packages/cli/src/config/rollup.config.js

View workflow job for this annotation

GitHub Actions / build (18)

Unexpected ' TODO' comment: 'TODO figure out how to handle URL chunk...'

Check warning on line 262 in packages/cli/src/config/rollup.config.js

View workflow job for this annotation

GitHub Actions / build (18)

Unexpected 'todo' comment: 'TODO figure out how to handle URL chunk...'

Check warning on line 262 in packages/cli/src/config/rollup.config.js

View workflow job for this annotation

GitHub Actions / build (18)

Unexpected ' TODO' comment: 'TODO figure out how to handle URL chunk...'
// https://github.com/ProjectEvergreen/greenwood/issues/1163
}

Expand Down Expand Up @@ -400,8 +400,8 @@
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),
Expand All @@ -421,7 +421,7 @@
switch (code) {

case 'CIRCULAR_DEPENDENCY':
// TODO let this through for lit by suppressing it

Check warning on line 424 in packages/cli/src/config/rollup.config.js

View workflow job for this annotation

GitHub Actions / build (18)

Unexpected 'todo' comment: 'TODO let this through for lit by...'

Check warning on line 424 in packages/cli/src/config/rollup.config.js

View workflow job for this annotation

GitHub Actions / build (18)

Unexpected ' TODO' comment: 'TODO let this through for lit by...'

Check warning on line 424 in packages/cli/src/config/rollup.config.js

View workflow job for this annotation

GitHub Actions / build (18)

Unexpected 'todo' comment: 'TODO let this through for lit by...'

Check warning on line 424 in packages/cli/src/config/rollup.config.js

View workflow job for this annotation

GitHub Actions / build (18)

Unexpected ' TODO' comment: 'TODO let this through for lit by...'
// Error: the string "Circular dependency: ../../../../../node_modules/@lit-labs/ssr/lib/render-lit-html.js ->
// ../../../../../node_modules/@lit-labs/ssr/lib/lit-element-renderer.js -> ../../../../../node_modules/@lit-labs/ssr/lib/render-lit-html.js\n" was thrown, throw an Error :)
// https://github.com/lit/lit/issues/449
Expand Down
12 changes: 6 additions & 6 deletions packages/plugin-adapter-netlify/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand All @@ -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 }
);
}
Expand Down
12 changes: 6 additions & 6 deletions packages/plugin-adapter-vercel/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand All @@ -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 }
);
}
Expand Down
Loading