$ brew install yarn
$ yarn init
$ touch tsconfig.json
$ yarn add typescript @types/node
{
"compilerOptions": {
"target": "ES2015",
"module": "commonjs",
"strict": true,
"jsx": "preserve",
"esModuleInterop": true,
"skipLibCheck": true,
"forceConsistentCasingInFileNames": true
},
"include": ["**/*.ts", "**/*.tsx"],
"exclude": ["node_modules"]
}
$ yarn add react react-dom @types/react
$ yarn add next
$ mkdir pages
$ touch pages/index.tsx
package.json
に付け足す。
"scripts": {
"dev": "next dev",
"build": "next build",
"start": "next start",
"lint": "next lint"
}
pages/index.tsx
の内容
import React from 'react'
const IndexPage = () => {
return <div>Hello, World!</div>
}
export default IndexPage
start develop
$ yarn dev
ignore .next/
folder
$ touch .gitignore
$ echo ".next" >> .gitignore
$ echo "node_modules/**" >> .gitignore
access localhost:3000