enzonotario / vitepress-openapi

Generate VitePress API Docs from OpenAPI specifications
https://vitepress-openapi.vercel.app
MIT License
54 stars 9 forks source link

Errors when building docs #105

Closed wighawag closed 3 weeks ago

wighawag commented 3 weeks ago

Current behavior

I just added vitepress-openapi as documented + added the markdown file

And I get many errors the last one shown being:

Build failed with 1 error:
node_modules/.pnpm/esbuild@0.21.5/node_modules/esbuild/lib/main.js:1225:27: ERROR: [plugin: externalize-deps] "vitepress-openapi" resolved to an ESM file. ESM file cannot be loaded by `require`. See https://vite.dev/guide/troubleshooting.html#this-package-is-esm-only for more details.
Error: Build failed with 1 error:
node_modules/.pnpm/esbuild@0.21.5/node_modules/esbuild/lib/main.js:1225:27: ERROR: [plugin: externalize-deps] "vitepress-openapi" resolved to an ESM file. ESM file cannot be loaded by `require`. See https://vite.dev/guide/troubleshooting.html#this-package-is-esm-only for more details.
    at failureErrorWithLog (/home/wighawag/dev/github.com/wighawag/fuzd/node_modules/.pnpm/esbuild@0.21.5/node_modules/esbuild/lib/main.js:1472:15)
    at /home/wighawag/dev/github.com/wighawag/fuzd/node_modules/.pnpm/esbuild@0.21.5/node_modules/esbuild/lib/main.js:945:25
    at runOnEndCallbacks (/home/wighawag/dev/github.com/wighawag/fuzd/node_modules/.pnpm/esbuild@0.21.5/node_modules/esbuild/lib/main.js:1315:45)
    at buildResponseToResult (/home/wighawag/dev/github.com/wighawag/fuzd/node_modules/.pnpm/esbuild@0.21.5/node_modules/esbuild/lib/main.js:943:7)
    at /home/wighawag/dev/github.com/wighawag/fuzd/node_modules/.pnpm/esbuild@0.21.5/node_modules/esbuild/lib/main.js:970:16
    at responseCallbacks.<computed> (/home/wighawag/dev/github.com/wighawag/fuzd/node_modules/.pnpm/esbuild@0.21.5/node_modules/esbuild/lib/main.js:622:9)
    at handleIncomingPacket (/home/wighawag/dev/github.com/wighawag/fuzd/node_modules/.pnpm/esbuild@0.21.5/node_modules/esbuild/lib/main.js:677:12)
    at Socket.readFromStdout (/home/wighawag/dev/github.com/wighawag/fuzd/node_modules/.pnpm/esbuild@0.21.5/node_modules/esbuild/lib/main.js:600:7)
    at Socket.emit (node:events:519:28)
    at addChunk (node:internal/streams/readable:561:12)
⠦ building client + server bundles...

Desired behavior

No error

Reproduction

No response

Steps to reproduce

git clone https://github.com/wighawag/fuzd.git cd fuzd git checkout feat/vitepress-openapi pnpm i pnpm docs:build

Logs and Error Messages

No response

Other Information

No response

enzonotario commented 3 weeks ago

Hi @wighawag , thanks for reporting!

This package is ESM-only, as it aligns to VitePress. As mentioned in the Vite documentation, the solution would be to:

However, while testing your repo, I also noticed an issue related to operations that don't have tags, so I've fixed that in v0.0.3-alpha.47.

You can see an example of your spec in StackBlitz.

If you encounter any other issues, feel free to open a new one. Thanks!

wighawag commented 3 weeks ago

Thanks!