astro/packages/renderers/renderer-lit/index.js
Drew Powers 330620e1b3 Update renderer API for Vite (#1623)
* Update renderer API for Vite

* Fix lit-element tests

* Clean up comments

* Throw friendly error if renderer provides viteConfig in a bad format
2021-10-22 16:25:38 -06:00

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',
],
},
};
},
};