Skip to content

Commit 52d1cca

Browse files
authored
Merge pull request #976 from objectstack-ai/copilot/fix-module-not-found-error-again
2 parents 299bcd7 + 3fb13e4 commit 52d1cca

3 files changed

Lines changed: 36 additions & 9 deletions

File tree

CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,13 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
2727
injecting a pre-configured `@libsql/client` instance via `config.client`.
2828

2929
### Fixed
30+
- **Vercel deployment — `ERR_MODULE_NOT_FOUND` for `@objectstack/metadata`** — Fixed incorrect
31+
`exports` paths in `@objectstack/metadata` `package.json` that pointed directly to TypeScript
32+
source files (`src/index.ts`, `src/node.ts`) instead of compiled dist output. Node.js cannot
33+
import `.ts` files at runtime, causing `ERR_MODULE_NOT_FOUND` on Vercel. Updated `main`, `types`,
34+
and `exports` to reference dist files (`dist/index.js`, `dist/index.mjs`, `dist/node.mjs`, etc.).
35+
Added a local `tsup.config.ts` with both entry points (`src/index.ts`, `src/node.ts`) and a
36+
`files` field to the package.json. Follows the same pattern as `@objectstack/spec`.
3037
- **Vercel deployment — `ERR_MODULE_NOT_FOUND` for `@objectstack/service-feed`** — Fixed incorrect
3138
`exports` paths in `package.json` for all service packages that declare `"type": "module"`. When
3239
`tsup` builds an ESM package (`"type": "module"`), it outputs `.js` for ESM and `.cjs` for CJS.

packages/metadata/package.json

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,22 +3,26 @@
33
"version": "3.3.0",
44
"license": "Apache-2.0",
55
"description": "Metadata loading, saving, and persistence for ObjectStack",
6-
"main": "src/index.ts",
7-
"types": "src/index.ts",
6+
"main": "dist/index.js",
7+
"types": "dist/index.d.ts",
88
"exports": {
99
".": {
10-
"types": "./src/index.ts",
11-
"import": "./src/index.ts",
12-
"default": "./src/index.ts"
10+
"types": "./dist/index.d.ts",
11+
"import": "./dist/index.mjs",
12+
"require": "./dist/index.js"
1313
},
1414
"./node": {
15-
"types": "./src/node.ts",
16-
"import": "./src/node.ts",
17-
"default": "./src/node.ts"
15+
"types": "./dist/node.d.ts",
16+
"import": "./dist/node.mjs",
17+
"require": "./dist/node.js"
1818
}
1919
},
20+
"files": [
21+
"dist",
22+
"README.md"
23+
],
2024
"scripts": {
21-
"build": "tsup --config ../../tsup.config.ts",
25+
"build": "tsup",
2226
"dev": "tsc --watch",
2327
"clean": "rm -rf dist",
2428
"test": "vitest run",

packages/metadata/tsup.config.ts

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
// Copyright (c) 2025 ObjectStack. Licensed under the Apache-2.0 license.
2+
3+
import { defineConfig } from 'tsup';
4+
5+
export default defineConfig({
6+
entry: [
7+
'src/index.ts',
8+
'src/node.ts',
9+
],
10+
splitting: false,
11+
sourcemap: true,
12+
clean: true,
13+
dts: true,
14+
format: ['esm', 'cjs'],
15+
target: 'es2020',
16+
});

0 commit comments

Comments
 (0)