Repository navigation
fix(metadata): add "type": "module" to fix ERR_MODULE_NOT_FOUND on Vercel - #977
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
|
Deployment failed with the following error: Learn More: https://vercel.com/docs/environment-variables |
…OT_FOUND on Vercel Convert @objectstack/metadata to "type": "module" to align with @objectstack/core, @objectstack/runtime, and @objectstack/rest. Updates exports from .mjs/.js to .js/.cjs pattern to ensure proper ESM resolution in Vercel serverless functions. Co-authored-by: hotlong <50353452+hotlong@users.noreply.github.com> Agent-Logs-Url: https://github.com/objectstack-ai/spec/sessions/b01a87bf-6ae6-4372-a353-df7cb055f1ec
"type": "module" to fix ERR_MODULE_NOT_FOUND on Vercel
There was a problem hiding this comment.
Pull request overview
This PR fixes a Vercel runtime resolution issue where @objectstack/metadata was being resolved to src/index.ts instead of the compiled dist/ output by aligning the package’s ESM/CJS metadata with the rest of the monorepo packages that work correctly on Vercel.
Changes:
- Added
"type": "module"to@objectstack/metadataand updatedexportsto use the.js(ESM) /.cjs(CJS) pattern. - Added a changelog entry documenting the Vercel
ERR_MODULE_NOT_FOUNDfix.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| packages/metadata/package.json | Switches the package to ESM via "type": "module" and updates exports mappings to point to the correct compiled artifacts (.js/.cjs). |
| packages/metadata/CHANGELOG.md | Documents the runtime fix for Vercel module resolution. |
|
|
||
| ### Patch Changes | ||
|
|
||
| - Fix ERR_MODULE_NOT_FOUND on Vercel: add `"type": "module"` and update exports to use `.js`/`.cjs` pattern (consistent with @objectstack/core, @objectstack/runtime) |
There was a problem hiding this comment.
The inline code snippet in the changelog includes escaped quotes (\"type\": \"module\"), which will render the backslashes in Markdown. Use unescaped quotes inside the backticks so it displays as "type": "module" without backslashes in the rendered output.
Vercel serverless runtime resolves
@objectstack/metadatatosrc/index.tsinstead of compileddist/output, causingERR_MODULE_NOT_FOUNDat runtime inapps/studio/api/index.js.Changes
packages/metadata/package.json: Add"type": "module"and update exports from.mjs/.jsto.js/.cjs— aligning with@objectstack/core,@objectstack/runtime, and@objectstack/restwhich all resolve correctly on VercelAll 154 metadata tests and 13 studio tests pass. Build output verified: tsup correctly emits
.js(ESM) and.cjs(CJS) with"type": "module".Original prompt
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.