Skip to content

Conversation

@AJEdgarCraft
Copy link

The build process failed because Vite's client-side bundling analysis encountered top-level imports of Node.js built-in module 'node:path' in integration.ts. Vite externalizes these modules for browser compatibility, causing errors like "dirname is not exported by __vite-browser-external". Although the integration hook runs in Node.js, the static imports at the top level triggered this Vite behavior during the client build phase. This fix replaces the Node.js path resolution imports and functions with the standard ES Module pattern. The URL constructor is correctly handled by Node.js and Astro's build pipeline for integration entrypoints, avoiding the top-level import issues and allowing the build to complete successfully while maintaining portability.

The build process failed because Vite's client-side bundling analysis
encountered top-level imports of Node.js built-in module 'node:path'
in integration.ts. Vite externalizes these modules for browser
compatibility, causing errors like "dirname is not exported by
__vite-browser-external". Although the integration hook runs in Node.js,
the static imports at the top level triggered this Vite behavior during
the client build phase. This fix replaces the Node.js path resolution
imports and functions with the standard ES Module pattern. The `URL`
constructor is correctly handled by Node.js and Astro's build pipeline
for integration entrypoints, avoiding the top-level import issues and
allowing the build to complete successfully while maintaining
portability.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant