Skip to content

Commit

Permalink
Update example to use the Lit SSR nextjs plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
augustjk committed Feb 8, 2023
1 parent cea642f commit c42e73d
Show file tree
Hide file tree
Showing 6 changed files with 8 additions and 12 deletions.
6 changes: 0 additions & 6 deletions .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -100,12 +100,6 @@
"rules": {
"import/no-extraneous-dependencies": "off"
}
},
{
"files": ["examples/**"],
"rules": {
"import/extensions": "off"
}
}
]
}
1 change: 1 addition & 0 deletions examples/nextjs/.eslintrc.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{
"root": true,
"extends": "next/core-web-vitals"
}
5 changes: 2 additions & 3 deletions examples/nextjs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,5 @@
This is a barebones demonstration of a Web Component authored with Lit working
in a Next.js project. You can also see an example of `@lit-labs/react` usage.

These components are shallowly rendered on the server, i.e. only the host
element tag will be server-rendered. When client-side JS is loaded, the
components will be upgraded with its contents rendered, and become interactive.
It uses the plugin from `@lit-labs/nextjs` to enable deep server rendering of
Lit components.
4 changes: 3 additions & 1 deletion examples/nextjs/next.config.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
const withLitSSR = require('@lit-labs/nextjs')();

/** @type {import('next').NextConfig} */
const nextConfig = {
reactStrictMode: true,
swcMinify: true,
};

module.exports = nextConfig;
module.exports = withLitSSR(nextConfig);
3 changes: 2 additions & 1 deletion examples/nextjs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,13 @@
"lint": "next lint"
},
"dependencies": {
"@lit-labs/nextjs": "file:../../packages/labs/nextjs",
"@lit-labs/react": "file:../../packages/labs/react",
"@types/node": "18.11.11",
"@types/react": "18.0.26",
"@types/react-dom": "18.0.9",
"eslint": "8.29.0",
"eslint-config-next": "13.0.6",
"@lit-labs/react": "file:../../packages/labs/react",
"lit": "file:../../packages/lit",
"next": "13.0.6",
"react": "18.2.0",
Expand Down
1 change: 0 additions & 1 deletion examples/nextjs/src/simple-greeter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@ declare global {
'simple-greeter': SimpleGreeter;
}

// eslint-disable-next-line @typescript-eslint/no-namespace
namespace JSX {
interface IntrinsicElements {
'simple-greeter':
Expand Down

0 comments on commit c42e73d

Please sign in to comment.