omermecitoglu / next-openapi-json-generator

a Next.js plugin to generate OpenAPI documentation from route handlers
MIT License
1 stars 2 forks source link

Warning pnpm: "critical dependency: the request of a dependency is an expression" #5

Closed gvzq closed 1 week ago

gvzq commented 1 week ago

When using pnpm to run "@omer-x/next-openapi-json-generator": "^0.2.5" there's a warning that occurs every single time generateOpenApiSpec is called.

 ⚠ ./node_modules/.pnpm/typescript@5.5.3/node_modules/typescript/lib/typescript.js
Critical dependency: the request of a dependency is an expression

Import trace for requested module:
./node_modules/.pnpm/typescript@5.5.3/node_modules/typescript/lib/typescript.js
./node_modules/.pnpm/@omer-x+next-openapi-json-generator@0.2.6_@omer-x+next-openapi-route-handler@0.4.3_zod@3.23.8__zod@3.23.8/node_modules/@omer-x/next-openapi-json-generator/dist/index.js
./app/openapi/route.ts
omermecitoglu commented 1 week ago

I don't think it's about pnpm

Can you try adding this in your next.config.js

const nextConfig = {
  webpack: config => {
    config.externals.push("typescript");
    return config;
  },
};

That's what I do, because node_modules/lib/typescript.js is 8.9mb and makes next.js dev server so slow

gvzq commented 1 week ago

My error disappeared. I agree I think it's a typescript error. I added tsx and updated @omer-x/next-openapi-json-generator. I'm leaving this here in case it helps someone else.

"tsx": "^4.16.2"
"@omer-x/next-openapi-json-generator": "^0.2.6

I don't think it's about pnpm

Can you try adding this in your next.config.js

const nextConfig = {
  webpack: config => {
    config.externals.push("typescript");
    return config;
  },
};

That's what I do, because node_modules/lib/typescript.js is 8.9mb and makes next.js dev server so slow