#Newly created Next project with Nx Monorepo throws "Cannot GET /"

13 messages · Page 1 of 1 (latest)

noble glen
#

What can I do to solve this issue?

noble glen
#

next.config.js

//@ts-check

// eslint-disable-next-line @typescript-eslint/no-var-requires
const { withNx } = require('@nrwl/next/plugins/with-nx')

/**
 * @type {import('@nrwl/next/plugins/with-nx').WithNxOptions}
 **/
const nextConfig = {
  nx: {
    // Set this to true if you would like to to use SVGR
    // See: https://github.com/gregberge/svgr
    svgr: false
  }
}

module.exports = withNx(nextConfig)

#

project.json

{
  "name": "web-site",
  "$schema": "../../../node_modules/nx/schemas/project-schema.json",
  "sourceRoot": "apps/web/site",
  "projectType": "application",
  "targets": {
    "build": {
      "executor": "@nrwl/next:build",
      "outputs": ["{options.outputPath}"],
      "defaultConfiguration": "production",
      "options": {
        "root": "apps/web/site",
        "outputPath": "dist/apps/web/site"
      },
      "configurations": {
        "development": {
          "outputPath": "apps/web/site"
        },
        "production": {}
      }
    },
    "serve": {
      "executor": "@nrwl/next:server",
      "defaultConfiguration": "development",
      "options": {
        "buildTarget": "web-site:build",
        "dev": true
      },
      "configurations": {
        "development": {
          "buildTarget": "web-site:build:development",
          "dev": true
        },
        "production": {
          "buildTarget": "web-site:build:production",
          "dev": false
        }
      }
    },
    "export": {
      "executor": "@nrwl/next:export",
      "options": {
        "buildTarget": "web-site:build:production"
      }
    },
    "test": {
      "executor": "@nrwl/jest:jest",
      "outputs": ["{workspaceRoot}/coverage/{projectRoot}"],
      "options": {
        "jestConfig": "apps/web/site/jest.config.ts",
        "passWithNoTests": true
      },
      "configurations": {
        "ci": {
          "ci": true,
          "codeCoverage": true
        }
      }
    },
    "lint": {
      "executor": "@nrwl/linter:eslint",
      "outputs": ["{options.outputFile}"],
      "options": {
        "lintFilePatterns": ["apps/web/site/**/*.{ts,tsx,js,jsx}"]
      }
    }
  },
  "tags": []
}

#

tsconfig.json

{
  "extends": "../../../tsconfig.base.json",
  "compilerOptions": {
    "jsx": "preserve",
    "allowJs": true,
    "esModuleInterop": true,
    "allowSyntheticDefaultImports": true,
    "strict": false,
    "forceConsistentCasingInFileNames": true,
    "noEmit": true,
    "resolveJsonModule": true,
    "isolatedModules": true,
    "incremental": true,
    "types": ["jest", "node"]
  },
  "include": ["**/*.ts", "**/*.tsx", "**/*.js", "**/*.jsx", "next-env.d.ts"],
  "exclude": [
    "node_modules",
    "jest.config.ts",
    "src/**/*.spec.ts",
    "src/**/*.test.ts"
  ]
}
noble glen
#

after much more deep investigations I did find that it builds both version

#

IT SHOULD NOT

noble glen
#

Updating

The issue is NextServer is not receiving requests

#

Working one

#

Dead one

#

Hey @patent pollen! I think it is not issue in Nx but rathen in NextServer Can you suggest something on this?