From 0d3730983cd8abe7dcf7d1edfccaf7d377ab3c8b Mon Sep 17 00:00:00 2001 From: Doug Richar Date: Mon, 3 Nov 2025 00:21:04 -0500 Subject: [PATCH 1/2] fix(examples): add vite build configuration for production builds - Add global to globalThis polyfill definition - Add `rollupOptions` to exclude `vite-plugin-node-polyfills` buffer shim - Fixes build errors with `vite-plugin-node-polyfills` v0.24.0 + Vite 6 --- examples/api-search/vite.config.ts | 10 ++++++++++ examples/claim-nfd/vite.config.ts | 10 ++++++++++ examples/link-address/vite.config.ts | 10 ++++++++++ examples/mint/vite.config.ts | 10 ++++++++++ examples/nfd-metadata/vite.config.ts | 10 ++++++++++ examples/resolve/vite.config.ts | 10 ++++++++++ examples/reverse-lookup/vite.config.ts | 10 ++++++++++ examples/set-metadata/vite.config.ts | 10 ++++++++++ examples/set-primary-nfd/vite.config.ts | 10 ++++++++++ 9 files changed, 90 insertions(+) diff --git a/examples/api-search/vite.config.ts b/examples/api-search/vite.config.ts index e42dc7c..1a7bb85 100644 --- a/examples/api-search/vite.config.ts +++ b/examples/api-search/vite.config.ts @@ -12,4 +12,14 @@ export default defineConfig({ }, }), ], + define: { + global: 'globalThis', + }, + build: { + rollupOptions: { + // Workaround for vite-plugin-node-polyfills v0.24.0 + Vite 6 build issue + // See: https://github.com/davidmyersdev/vite-plugin-node-polyfills/issues/81 + external: ['vite-plugin-node-polyfills/shims/buffer'], + }, + }, }) diff --git a/examples/claim-nfd/vite.config.ts b/examples/claim-nfd/vite.config.ts index e42dc7c..1a7bb85 100644 --- a/examples/claim-nfd/vite.config.ts +++ b/examples/claim-nfd/vite.config.ts @@ -12,4 +12,14 @@ export default defineConfig({ }, }), ], + define: { + global: 'globalThis', + }, + build: { + rollupOptions: { + // Workaround for vite-plugin-node-polyfills v0.24.0 + Vite 6 build issue + // See: https://github.com/davidmyersdev/vite-plugin-node-polyfills/issues/81 + external: ['vite-plugin-node-polyfills/shims/buffer'], + }, + }, }) diff --git a/examples/link-address/vite.config.ts b/examples/link-address/vite.config.ts index e42dc7c..1a7bb85 100644 --- a/examples/link-address/vite.config.ts +++ b/examples/link-address/vite.config.ts @@ -12,4 +12,14 @@ export default defineConfig({ }, }), ], + define: { + global: 'globalThis', + }, + build: { + rollupOptions: { + // Workaround for vite-plugin-node-polyfills v0.24.0 + Vite 6 build issue + // See: https://github.com/davidmyersdev/vite-plugin-node-polyfills/issues/81 + external: ['vite-plugin-node-polyfills/shims/buffer'], + }, + }, }) diff --git a/examples/mint/vite.config.ts b/examples/mint/vite.config.ts index e42dc7c..1a7bb85 100644 --- a/examples/mint/vite.config.ts +++ b/examples/mint/vite.config.ts @@ -12,4 +12,14 @@ export default defineConfig({ }, }), ], + define: { + global: 'globalThis', + }, + build: { + rollupOptions: { + // Workaround for vite-plugin-node-polyfills v0.24.0 + Vite 6 build issue + // See: https://github.com/davidmyersdev/vite-plugin-node-polyfills/issues/81 + external: ['vite-plugin-node-polyfills/shims/buffer'], + }, + }, }) diff --git a/examples/nfd-metadata/vite.config.ts b/examples/nfd-metadata/vite.config.ts index e42dc7c..1a7bb85 100644 --- a/examples/nfd-metadata/vite.config.ts +++ b/examples/nfd-metadata/vite.config.ts @@ -12,4 +12,14 @@ export default defineConfig({ }, }), ], + define: { + global: 'globalThis', + }, + build: { + rollupOptions: { + // Workaround for vite-plugin-node-polyfills v0.24.0 + Vite 6 build issue + // See: https://github.com/davidmyersdev/vite-plugin-node-polyfills/issues/81 + external: ['vite-plugin-node-polyfills/shims/buffer'], + }, + }, }) diff --git a/examples/resolve/vite.config.ts b/examples/resolve/vite.config.ts index e42dc7c..1a7bb85 100644 --- a/examples/resolve/vite.config.ts +++ b/examples/resolve/vite.config.ts @@ -12,4 +12,14 @@ export default defineConfig({ }, }), ], + define: { + global: 'globalThis', + }, + build: { + rollupOptions: { + // Workaround for vite-plugin-node-polyfills v0.24.0 + Vite 6 build issue + // See: https://github.com/davidmyersdev/vite-plugin-node-polyfills/issues/81 + external: ['vite-plugin-node-polyfills/shims/buffer'], + }, + }, }) diff --git a/examples/reverse-lookup/vite.config.ts b/examples/reverse-lookup/vite.config.ts index e42dc7c..1a7bb85 100644 --- a/examples/reverse-lookup/vite.config.ts +++ b/examples/reverse-lookup/vite.config.ts @@ -12,4 +12,14 @@ export default defineConfig({ }, }), ], + define: { + global: 'globalThis', + }, + build: { + rollupOptions: { + // Workaround for vite-plugin-node-polyfills v0.24.0 + Vite 6 build issue + // See: https://github.com/davidmyersdev/vite-plugin-node-polyfills/issues/81 + external: ['vite-plugin-node-polyfills/shims/buffer'], + }, + }, }) diff --git a/examples/set-metadata/vite.config.ts b/examples/set-metadata/vite.config.ts index e42dc7c..1a7bb85 100644 --- a/examples/set-metadata/vite.config.ts +++ b/examples/set-metadata/vite.config.ts @@ -12,4 +12,14 @@ export default defineConfig({ }, }), ], + define: { + global: 'globalThis', + }, + build: { + rollupOptions: { + // Workaround for vite-plugin-node-polyfills v0.24.0 + Vite 6 build issue + // See: https://github.com/davidmyersdev/vite-plugin-node-polyfills/issues/81 + external: ['vite-plugin-node-polyfills/shims/buffer'], + }, + }, }) diff --git a/examples/set-primary-nfd/vite.config.ts b/examples/set-primary-nfd/vite.config.ts index e42dc7c..1a7bb85 100644 --- a/examples/set-primary-nfd/vite.config.ts +++ b/examples/set-primary-nfd/vite.config.ts @@ -12,4 +12,14 @@ export default defineConfig({ }, }), ], + define: { + global: 'globalThis', + }, + build: { + rollupOptions: { + // Workaround for vite-plugin-node-polyfills v0.24.0 + Vite 6 build issue + // See: https://github.com/davidmyersdev/vite-plugin-node-polyfills/issues/81 + external: ['vite-plugin-node-polyfills/shims/buffer'], + }, + }, }) From cd2896e4113733a848dac59883cab3ef3f06f704 Mon Sep 17 00:00:00 2001 From: Doug Richar Date: Mon, 3 Nov 2025 00:25:28 -0500 Subject: [PATCH 2/2] ci: add example builds to workflows - Add 'Build Examples' step to PR workflow - Add 'Build Examples' step to CI workflow before publish - Fix `build:examples` script to use correct filter pattern --- .github/workflows/ci.yml | 3 +++ .github/workflows/pr.yml | 3 +++ package.json | 2 +- 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 16604ca..9c5af28 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -65,6 +65,9 @@ jobs: - name: Build run: pnpm build + - name: Build Examples + run: pnpm build:examples + - name: Publish run: | git config --global user.name 'Doug Richar' diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index 2142a9c..297ce06 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -58,3 +58,6 @@ jobs: - name: Build run: pnpm build + + - name: Build Examples + run: pnpm build:examples diff --git a/package.json b/package.json index c232b80..4d706e1 100644 --- a/package.json +++ b/package.json @@ -5,7 +5,7 @@ "type": "module", "scripts": { "build": "pnpm --filter @txnlab/nfd-sdk build", - "build:examples": "pnpm --filter @txnlab/nfd-sdk-examples build", + "build:examples": "pnpm --filter './examples/*' build", "test": "pnpm -r test", "lint": "pnpm -r lint", "format": "pnpm -r format",