41 lines
989 B
Markdown
41 lines
989 B
Markdown
- nextjs alternative : remix
|
|
Initialization
|
|
https://yewtu.be/watch?v=__mSgDEOyv8
|
|
|
|
- Use this to setup nextjs
|
|
`npx create-next-app@latest myapp`
|
|
Then `npm run dev` to run it
|
|
- To run a production build
|
|
`npm run build` then
|
|
`npm run start`
|
|
- Running on different port
|
|
In `package.json`
|
|
```json
|
|
"scripts": {
|
|
"dev": "next dev -p 3001",
|
|
"build": "next build",
|
|
"start": "next start -p 3001",
|
|
"lint": "next lint"
|
|
},
|
|
```
|
|
- running it as serverless mode, generate SSG
|
|
in next.config.js, do following for static export
|
|
```js
|
|
/**
|
|
* @type {import('next').NextConfig}
|
|
*/
|
|
const nextConfig = {
|
|
output: 'export',
|
|
|
|
// Optional: Change links `/me` -> `/me/` and emit `/me.html` -> `/me/index.html`
|
|
// trailingSlash: true,
|
|
|
|
// Optional: Prevent automatic `/me` -> `/me/`, instead preserve `href`
|
|
// skipTrailingSlashRedirect: true,
|
|
|
|
// Optional: Change the output directory `out` -> `dist`
|
|
// distDir: 'dist',
|
|
}
|
|
|
|
module.exports = nextConfig
|
|
```
|