Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Docs] Migrate using-preact example to typescript #40295

Merged
merged 3 commits into from Sep 7, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
7 changes: 5 additions & 2 deletions examples/using-preact/next.config.js
@@ -1,5 +1,8 @@
const withPreact = require('next-plugin-preact')

module.exports = withPreact({
/** @type {import('next').NextConfig} */
const nextConfig = {
/* regular next.js config options here */
})
}

module.exports = withPreact(nextConfig)
20 changes: 12 additions & 8 deletions examples/using-preact/package.json
Expand Up @@ -5,14 +5,18 @@
"build": "next build",
"start": "next start"
},
"devDependencies": {},
"dependencies": {
"next": "^12.0.0",
"next-plugin-preact": "^3.0.6",
"preact": "^10.5.15",
"preact-render-to-string": "^5.1.19",
"react": "npm:@preact/compat@^17.0.2",
"react-dom": "npm:@preact/compat@^17.0.2",
"react-ssr-prepass": "npm:preact-ssr-prepass@^1.2.0"
"next": "latest",
"next-plugin-preact": "latest",
"preact": "^10.10.6",
"preact-render-to-string": "^5.2.3",
"react": "npm:@preact/compat@^17.1.1",
"react-dom": "npm:@preact/compat@^17.1.1",
"react-ssr-prepass": "npm:preact-ssr-prepass@1.2.0"
},
"devDependencies": {
"@types/node": "18.7.15",
HaNdTriX marked this conversation as resolved.
Show resolved Hide resolved
"@types/react": "16.9.17",
"typescript": "4.8.2"
}
}
3 changes: 0 additions & 3 deletions examples/using-preact/pages/about.js

This file was deleted.

3 changes: 3 additions & 0 deletions examples/using-preact/pages/about.tsx
@@ -0,0 +1,3 @@
export default function AboutPage() {
return <div>About us</div>
}
@@ -1,6 +1,6 @@
import Link from 'next/link'

export default function Home() {
export default function IndexPage() {
return (
<div>
Hello World.{' '}
Expand Down
9 changes: 0 additions & 9 deletions examples/using-preact/pages/ssg.js

This file was deleted.

13 changes: 13 additions & 0 deletions examples/using-preact/pages/ssg.tsx
@@ -0,0 +1,13 @@
import { InferGetStaticPropsType } from 'next'

export function getStaticProps() {
return {
props: { framework: 'preact' },
}
}

export default function SSGPage({
framework,
}: InferGetStaticPropsType<typeof getStaticProps>) {
return <div>{framework} ssg example</div>
}
9 changes: 0 additions & 9 deletions examples/using-preact/pages/ssr.js

This file was deleted.

13 changes: 13 additions & 0 deletions examples/using-preact/pages/ssr.tsx
@@ -0,0 +1,13 @@
import { InferGetServerSidePropsType } from 'next'

export function getServerSideProps() {
return {
props: { framework: 'preact' },
}
}

export default function SSRPage({
framework,
}: InferGetServerSidePropsType<typeof getServerSideProps>) {
return <div>{framework} ssr example</div>
}
22 changes: 22 additions & 0 deletions examples/using-preact/tsconfig.json
@@ -0,0 +1,22 @@
{
"compilerOptions": {
"target": "es5",
"lib": ["dom", "dom.iterable", "esnext"],
"allowJs": true,
"skipLibCheck": true,
"strict": true,
"forceConsistentCasingInFileNames": true,
"noEmit": true,
"incremental": true,
"esModuleInterop": true,
"moduleResolution": "node",
"module": "esnext",
"resolveJsonModule": true,
"isolatedModules": true,
"jsx": "preserve",
"jsxFactory": "h",
"jsxFragmentFactory": "Fragment"
},
"include": ["next-env.d.ts", "**/*.ts", "**/*.tsx"],
"exclude": ["node_modules"]
}