From 2752c184c2e83547bbb403fe6a9a87f8db0288f2 Mon Sep 17 00:00:00 2001 From: Huynh Duc Dung Date: Wed, 25 Oct 2023 21:20:28 +0800 Subject: [PATCH] fix(example): try to build swagger ui with nextjs More details on https://github.com/swagger-api/swagger-ui/issues/9243 --- examples/next13-app/package.json | 2 +- examples/next13-app/swagger-build.js | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) create mode 100644 examples/next13-app/swagger-build.js diff --git a/examples/next13-app/package.json b/examples/next13-app/package.json index d451adb..4cb8dd3 100644 --- a/examples/next13-app/package.json +++ b/examples/next13-app/package.json @@ -3,7 +3,7 @@ "version": "0.0.2", "private": true, "scripts": { - "build": "next build", + "build": "node --require ./swagger-build.js ./node_modules/.bin/next build", "dev": "next dev", "format:check": "prettier --check \"**/*.{ts,tsx,mdx}\" --cache", "format:write": "prettier --write \"**/*.{ts,tsx,mdx}\" --cache", diff --git a/examples/next13-app/swagger-build.js b/examples/next13-app/swagger-build.js new file mode 100644 index 0000000..6b74ad2 --- /dev/null +++ b/examples/next13-app/swagger-build.js @@ -0,0 +1,3 @@ +const { File } = require("next/dist/compiled/undici") + +globalThis.File = globalThis.File ?? File