330620e1b3
* Update renderer API for Vite * Fix lit-element tests * Clean up comments * Throw friendly error if renderer provides viteConfig in a bad format
34 lines
1.1 KiB
JavaScript
34 lines
1.1 KiB
JavaScript
// NOTE: @lit-labs/ssr uses syntax incompatible with anything < Node v13.9.0.
|
|
// Throw an error if using that Node version.
|
|
|
|
const NODE_VERSION = parseFloat(process.versions.node);
|
|
if (NODE_VERSION < 13.9) {
|
|
throw new Error(`Package @lit-labs/ssr requires Node version v13.9 or higher. Please update Node to use @astrojs/renderer-lit`);
|
|
}
|
|
|
|
export default {
|
|
name: '@astrojs/renderer-lit',
|
|
server: './server.js',
|
|
polyfills: ['./client-shim.js'],
|
|
hydrationPolyfills: ['./hydration-support.js'],
|
|
viteConfig() {
|
|
return {
|
|
optimizeDeps: {
|
|
include: [
|
|
'@astrojs/renderer-lit/client-shim.js',
|
|
'@astrojs/renderer-lit/hydration-support.js',
|
|
'@webcomponents/template-shadowroot/template-shadowroot.js',
|
|
'lit/experimental-hydrate-support.js',
|
|
],
|
|
},
|
|
ssr: {
|
|
external: [
|
|
'lit-element/lit-element.js',
|
|
'@lit-labs/ssr/lib/install-global-dom-shim.js',
|
|
'@lit-labs/ssr/lib/render-lit-html.js',
|
|
'@lit-labs/ssr/lib/lit-element-renderer.js',
|
|
],
|
|
},
|
|
};
|
|
},
|
|
};
|