Files
analiticaNucleo/nuxt4-app/nuxt.config.workaround.ts
josedario87 da3b08f050
All checks were successful
deploy-analiticaNucleo / deploy (push) Successful in 5m42s
fix
2025-10-05 12:29:48 -06:00

32 lines
1.0 KiB
TypeScript

// Workaround for @nuxt/ui v4 import protection issue
// This is a temporary fix until @nuxt/ui properly handles ssr: false
import type { Plugin } from 'vite'
export function disableImportProtection(): Plugin {
return {
name: 'disable-import-protection-for-nuxt-ui',
enforce: 'pre',
resolveId(id, importer) {
// External node binary files
if (id.endsWith('.node')) {
return { id, external: true }
}
// External Node.js built-in modules
const nodeModules = ['fs', 'path', 'url', 'fs/promises', 'node:url', 'node:module', 'node:fs', 'node:path']
if (nodeModules.includes(id) || id.startsWith('node:')) {
return { id, external: true }
}
// External server-only packages from @nuxt/ui imports
const serverPackages = ['@nuxt/kit', '@tailwindcss/node', '@tailwindcss/oxide', 'jiti']
for (const pkg of serverPackages) {
if (id === pkg || id.startsWith(pkg + '/')) {
return { id, external: true }
}
}
}
}
}