Skip to content

Commit b3cc8d8

Browse files
committed
Issue-1118: Refactor rollup config generation for SSR
1 parent 66128d6 commit b3cc8d8

File tree

1 file changed

+46
-5
lines changed

1 file changed

+46
-5
lines changed

packages/cli/src/config/rollup.config.js

Lines changed: 46 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -382,11 +382,10 @@ const getRollupConfigForApis = async (compilation) => {
382382

383383
const getRollupConfigForSsr = async (compilation, input) => {
384384
const { outputDir } = compilation.context;
385+
console.log('SSR GOING ON', {input});
385386

386-
// TODO should routes and APIs have chunks?
387-
// https://github.com/ProjectEvergreen/greenwood/issues/1118
388-
return [{
389-
input,
387+
return input.map(filepath => ({
388+
input: filepath,
390389
output: {
391390
dir: normalizePathnameForWindows(outputDir),
392391
entryFileNames: '_[name].js',
@@ -423,7 +422,49 @@ const getRollupConfigForSsr = async (compilation, input) => {
423422

424423
}
425424
}
426-
}];
425+
}))
426+
427+
// TODO should routes and APIs have chunks?
428+
// https://github.com/ProjectEvergreen/greenwood/issues/1118
429+
// return [{
430+
// input,
431+
// output: {
432+
// dir: normalizePathnameForWindows(outputDir),
433+
// entryFileNames: '_[name].js',
434+
// chunkFileNames: '[name].[hash].js'
435+
// },
436+
// plugins: [
437+
// greenwoodJsonLoader(),
438+
// greenwoodResourceLoader(compilation),
439+
// // TODO let this through for lit to enable nodeResolve({ preferBuiltins: true })
440+
// // https://github.com/lit/lit/issues/449
441+
// // https://github.com/ProjectEvergreen/greenwood/issues/1118
442+
// nodeResolve({
443+
// preferBuiltins: true
444+
// }),
445+
// commonjs(),
446+
// greenwoodImportMetaUrl(compilation),
447+
// greenwoodPatchSsrPagesEntryPointRuntimeImport() // TODO a little hacky but works for now
448+
// ],
449+
// onwarn: (errorObj) => {
450+
// const { code, message } = errorObj;
451+
452+
// switch (code) {
453+
454+
// case 'CIRCULAR_DEPENDENCY':
455+
// // TODO let this through for lit by suppressing it
456+
// // Error: the string "Circular dependency: ../../../../../node_modules/@lit-labs/ssr/lib/render-lit-html.js ->
457+
// // ../../../../../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 :)
458+
// // https://github.com/lit/lit/issues/449
459+
// // https://github.com/ProjectEvergreen/greenwood/issues/1118
460+
// break;
461+
// default:
462+
// // otherwise, log all warnings from rollup
463+
// console.debug(message);
464+
465+
// }
466+
// }
467+
// }];
427468
};
428469

429470
export {

0 commit comments

Comments
 (0)