nuxt / vercel-builder

Vercel Builder for Nuxt
MIT License
645 stars 75 forks source link

Can't build nuxt-edge with typescript #703

Closed kota-nakagawa closed 10 months ago

kota-nakagawa commented 2 years ago

Hello !

I want to use vue 2.7 so Im using nuxt-edge. After installing typescript, the builds no longer pass.

ERROR in ./node_modules_dev/node-fetch-native/dist/index.cjs 69:2

スクリーンショット 2022-09-04 3 09 33

tsconfig.json

{
  "compilerOptions": {
    "target": "ES2018",
    "module": "ESNext",
    "moduleResolution": "Node",
    "resolveJsonModule": true,
    "esModuleInterop": true,
    "baseUrl": ".",
    "paths": {
      "@/*": ["./*"]
    },
    "sourceMap": true,
    "skipLibCheck": true,
    "strict": true,
    "noEmit": true,
    "types": [
      "@types/node",
      "@nuxt/types",
      "@pinia/nuxt",
      "pinia-plugin-persist",
      "webpack-env"
    ]
  },
  "vueCompilerOptions": {
    "target": 2.7
  },
  "exclude": [
    "node_modules",
    "dist",
    ".nuxt"
  ]
}

vercel.json

{
  "version": 2,
  "builds": [
    {
      "src": "package.json",
      "use": "@vercel/node"
    },
    {
      "src": "nuxt.config.ts",
      "use": "@nuxtjs/vercel-builder",
      "config": {
        "tscOptions": {
          "sourceMap": false
        },
        "serverFiles": [".nuxt/dist/sitemap-routes.json"]
      }
    }
  ]
}
kota-nakagawa commented 2 years ago

I'm currently using this method to work around and build.

  "resolutions": {
    "node-fetch-native": "npm:node-fetch@2.6.1"
  }