Skip to content

import.meta.url on mesh start #5360

Open
@JustinKim3420

Description

@JustinKim3420

Issue workflow progress

Progress of the issue based on the
Contributor Workflow

Make sure to fork this template and run yarn generate in the terminal.

Please make sure Mesh package versions under package.json matches yours.

  • 2. A failing test has been provided
  • 3. A local solution has been provided
  • 4. A pull request is pending review

Currently getting an issue when trying to run mesh start after a mesh build. The build is successful, however after trying to run mesh start I get an SyntaxError: Cannot use 'import.meta' outside a module error.

To Reproduce Steps to reproduce the behavior:
I am currently using next.js along with grapqhl-mesh, and here are the following config files. I just run mesh build then mesh start and I receive the syntax error.
tsconfig.json

{
  "compilerOptions": {
    "target": "es5",
    "lib": [
      "dom",
      "dom.iterable",
      "esnext"
    ],
    "allowJs": true,
    "skipLibCheck": true,
    "strict": true,
    "strictNullChecks": true,
    "forceConsistentCasingInFileNames": true,
    "noEmit": true,
    "esModuleInterop": true,
    "module": "esnext",
    "moduleResolution": "node",
    "resolveJsonModule": true,
    "isolatedModules": true,
    "jsx": "preserve",
    "incremental": true,
    "plugins": [
      {
        "name": "next"
      }
    ],
    "baseUrl": ".",
    "paths": {
      "@/*": [
        "./src/*"
      ]
    }
  },
  "include": [
    "src/**/*"
  ],
  "exclude": [
    "node_modules"
  ]
}

package.json

{
  "name": "scanapi",
  "version": "0.1.0",
  "private": true,
  "engines": {
    "node": "v16.20.0",
    "npm": ">=8.1.0"
  },
  "scripts": {
    "meshBuild": "mesh build",
    "meshStart": "mesh start",
    "dev": "nodemon",
    "build": "next build && tsc --project tsconfig.server.json",
    "start": "cross-env NODE_ENV=production node dist/src/server.js"
  },
  "dependencies": {
    "apollo": "^2.34.0",
    "cross-env": "^7.0.3",
    "dotenv": "^16.0.3",
    "express": "^4.18.2",
    "graphql": "^16.6.0",
    "next": "^12.3.2",
    "react": "18.2.0",
    "react-dom": "18.2.0",
    "typescript": "4.9.4",
    "zod": "^3.21.4"
  },
  "devDependencies": {
    "@types/json-to-ast": "^2.1.2",
    "@types/node": "^18.11.18",
    "@types/react": "^18.0.26",
    "@types/react-dom": "^18.0.10",
    "@typescript-eslint/eslint-plugin": "^5.0.0",
    "eslint": "^8.0.1",
    "eslint-config-next": "^13.1.2",
    "eslint-config-standard-with-typescript": "^30.0.0",
    "eslint-config-ts-standard": "^1.0.5",
    "eslint-plugin-import": "^2.25.2",
    "eslint-plugin-jsonc": "^2.6.0",
    "eslint-plugin-n": "^15.6.1",
    "eslint-plugin-promise": "^6.0.0",
    "next-compose-plugins": "^2.2.1",
    "next-transpile-modules": "^10.0.0",
    "nodemon": "^2.0.22"
  }
}

tsconfig.server.json

{
  "extends": "./tsconfig.json",
  "compilerOptions": {
    "module": "commonjs",
    "outDir": "dist",
    "lib": ["es2019"],
    "target": "es2019",
    "isolatedModules": false,
    "noEmit": false,
    "strictNullChecks": true,
    "strict": true
  },
  "include": ["./src/server.ts","./.mesh"]
}

Expected behavior
What I expected was for the local server to start running on some port, and show the graphql explorer-esque web page.

Environment:

  • OS: Mac Ventura 13.3.1
  • @graphql-mesh/cli: "^0.82.34"
  • @graphql-mesh/graphql: "^1.0.0"
  • @graphql-mesh/transform-filter-schema: "^1.0.0",
  • NodeJS: v16.20.0

Additional context

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions