"dirname" is not exported by "__vite-browser-external", imported by "nuxt.config.ts"
I have a Nuxt layer that I publish to a private NPM feed, and install into a few different Nuxt sites. After updating to Nuxt 3.16, some of the sites error like this when building:
WARN [plugin vite:resolve] Module "url" has been externalized for browser compatibility, imported by "~/node_modules/my-layer/nuxt.config.ts". WARN [plugin vite:resolve] Module "path" has been externalized for browser compatibility, imported by "~/node_modules/my-layer/nuxt.config.ts".
✓ 1056 modules transformed. ERROR ✗ Build failed in 58.83s
ERROR Nuxt Build Error: node_modules/my-layer/nuxt.config.ts (2:9): "dirname" is not exported by "__vite-browser-external", imported by "node_modules/my-layer/nuxt.config.ts". nuxi file: ~/node_modules/my-layer/nuxt.config.ts:2:9
I've diffed my sites' package.json and nuxt.config.ts files and can't see any clues as to why some work and some don't. Package updates don't make a difference. All run the same version of Node and pnpm. Switching package manager to npm didn't help. Changing the imports in the Nuxt layer to include node: didn't help.