mirror of
https://github.com/shoelace-style/webawesome.git
synced 2026-01-12 20:19:13 +00:00
disable SSR
This commit is contained in:
@@ -117,29 +117,6 @@ export default function (eleventyConfig) {
|
||||
]),
|
||||
);
|
||||
|
||||
// SSR plugin
|
||||
if (!isDev) {
|
||||
//
|
||||
// Problematic components in SSR land:
|
||||
// - animation (breaks on navigation + ssr with Turbo)
|
||||
// - mutation-observer (why SSR this?)
|
||||
// - resize-observer (why SSR this?)
|
||||
// - tooltip (why SSR this?)
|
||||
//
|
||||
const omittedModules = [];
|
||||
const componentModules = componentList
|
||||
.filter(component => !omittedModules.includes(component.tagName.split(/wa-/)[1]))
|
||||
.map(component => {
|
||||
const name = component.tagName.split(/wa-/)[1];
|
||||
return `./dist/components/${name}/${name}.js`;
|
||||
});
|
||||
|
||||
eleventyConfig.addPlugin(litPlugin, {
|
||||
mode: 'worker',
|
||||
componentModules,
|
||||
});
|
||||
}
|
||||
|
||||
// Build the search index
|
||||
eleventyConfig.addPlugin(
|
||||
searchPlugin({
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
import { litSsrPlugin } from '@lit-labs/testing/web-test-runner-ssr-plugin.js';
|
||||
import { esbuildPlugin } from '@web/dev-server-esbuild';
|
||||
import { playwrightLauncher } from '@web/test-runner-playwright';
|
||||
import { readFileSync } from 'fs';
|
||||
@@ -53,7 +52,6 @@ export default {
|
||||
ts: true,
|
||||
target: 'es2020',
|
||||
}),
|
||||
litSsrPlugin(),
|
||||
],
|
||||
browsers: [
|
||||
playwrightLauncher({ product: 'chromium', concurrency }),
|
||||
@@ -78,15 +76,8 @@ export default {
|
||||
${componentImports.map(str => `"${str}"`).join(',\n')}
|
||||
]
|
||||
|
||||
window.SSR_ONLY = ${process.env['SSR_ONLY'] === 'true'}
|
||||
window.CSR_ONLY = ${process.env['CSR_ONLY'] === 'true'}
|
||||
</script>
|
||||
<script type="module">
|
||||
;(async () => {
|
||||
await import('@lit-labs/ssr-client/lit-element-hydrate-support.js')
|
||||
await Promise.allSettled(window.clientComponents.map(str => import(str)));
|
||||
})()
|
||||
</script>
|
||||
<script type="module" src="${testFramework}"></script>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
Reference in New Issue
Block a user