joplin-notes/joplin notion extension/Web Development/React/next/Initialization.md
2026-11-04 00:33:23 +05:30

989 B

  • 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

      "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

     /**
      * @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