-
Notifications
You must be signed in to change notification settings - Fork 27.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Docs] Migrate using-preact example to typescript (#40295)
## Documentation / Examples - [x] Make sure the linting passes by running `pnpm lint` - [x] The examples guidelines are followed from [our contributing doc](https://github.com/vercel/next.js/blob/canary/contributing.md#adding-examples)
- Loading branch information
Showing
10 changed files
with
69 additions
and
32 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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:[email protected]" | ||
}, | ||
"devDependencies": { | ||
"@types/node": "18.7.15", | ||
"@types/react": "16.9.17", | ||
"typescript": "4.8.2" | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
export default function AboutPage() { | ||
return <div>About us</div> | ||
} |
2 changes: 1 addition & 1 deletion
2
examples/using-preact/pages/index.js → examples/using-preact/pages/index.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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> | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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> | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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"] | ||
} |