Skip to content

Fix ES module imports and CLI kernel reference#452

Merged
hotlong merged 2 commits intomainfrom
copilot/fix-upstream-bug-imports
Feb 1, 2026
Merged

Fix ES module imports and CLI kernel reference#452
hotlong merged 2 commits intomainfrom
copilot/fix-upstream-bug-imports

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Feb 1, 2026

Fixes ES module resolution failures and incorrect class import preventing CLI operation.

Changes

@objectstack/cli

  • ObjectStackKernelObjectKernel in serve command (correct export from @objectstack/core)

@objectstack/runtime@0.7.2

  • Add .js extension to route-manager import in rest-server.ts

@objectstack/objectql@0.7.2

  • package.json: main and types now point to dist/ instead of src/
  • Add .js extensions to all relative imports in index.ts, plugin.ts, engine.ts, protocol.ts

Example

// Before (runtime)
import { RouteManager } from './route-manager';

// After
import { RouteManager } from './route-manager.js';
// Before (objectql package.json)
{
  "main": "src/index.ts",
  "types": "src/index.ts"
}

// After
{
  "main": "dist/index.js",
  "types": "dist/index.d.ts"
}
Original prompt

Upstream Bug Fixes (pnpm patches)

@objectstack/runtime@0.7.2: Missing .js extensions in ES module imports

  • import { RouteManager } from './route-manager';
  • import { RouteManager } from './route-manager.js';
    @objectstack/objectql@0.7.2: Wrong package.json entry points + missing .js extensions
  • "main": "src/index.ts",
  • "types": "src/index.ts"
  • "main": "dist/index.js",
  • "types": "dist/index.d.ts"
    CLI Integration

Created objectstack.config.ts with plugin-based configuration:

export default {
plugins: [
new ObjectQLPlugin(),
new DriverPlugin(new KnexDriver({ ... }), 'default'),
],
server: { port: 3000 }
};
Blocker: @objectstack/cli imports non-existent ObjectStackKernel (should be ObjectKernel). Current scripts continue using NestJS server. objectstack:serve script added for future use.


💡 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.

@vercel
Copy link
Copy Markdown

vercel bot commented Feb 1, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
spec Ready Ready Preview, Comment Feb 1, 2026 2:16am

Request Review

…, fix package.json entries

Co-authored-by: hotlong <50353452+hotlong@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix missing .js extensions in ES module imports Fix ES module imports and CLI kernel reference Feb 1, 2026
Copilot AI requested a review from hotlong February 1, 2026 02:19
@github-actions github-actions bot added dependencies Pull requests that update a dependency file size/s labels Feb 1, 2026
@hotlong hotlong marked this pull request as ready for review February 1, 2026 02:30
Copilot AI review requested due to automatic review settings February 1, 2026 02:30
@hotlong hotlong merged commit 3490b6d into main Feb 1, 2026
13 checks passed
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This pull request addresses ES module resolution issues in the ObjectStack monorepo and corrects an incorrect class import in the CLI package. The changes ensure proper ES module compatibility across three packages by adding .js extensions to relative imports and fixing package entry points.

Changes:

  • Fixed incorrect kernel class reference from ObjectStackKernel to ObjectKernel in CLI serve command
  • Added .js extensions to all relative imports in @objectstack/objectql and @objectstack/runtime packages
  • Updated @objectstack/objectql package.json to point to compiled dist/ files instead of source src/ files

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
packages/cli/src/commands/serve.ts Corrects the kernel import from non-existent ObjectStackKernel to the correct ObjectKernel export
packages/runtime/src/rest-server.ts Adds .js extension to local route-manager import for ES module compliance
packages/objectql/src/protocol.ts Adds .js extension to local registry import
packages/objectql/src/plugin.ts Adds .js extensions to local engine and protocol imports
packages/objectql/src/index.ts Adds .js extensions to all local module exports
packages/objectql/src/engine.ts Adds .js extension to local registry import
packages/objectql/package.json Updates main and types entry points from src/ to dist/ directory

"description": "Isomorphic ObjectQL Engine for ObjectStack",
"main": "src/index.ts",
"types": "src/index.ts",
"main": "dist/index.js",
Copy link

Copilot AI Feb 1, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The package.json is missing the "type": "module" field. Since this package now uses ES module imports with .js extensions and points to compiled dist/ files, it should declare itself as an ES module. Without this field, Node.js will treat .js files as CommonJS, which will cause module resolution failures. Other packages in the monorepo (@objectstack/core and @objectstack/runtime) already have this field set.

Suggested change
"main": "dist/index.js",
"main": "dist/index.js",
"type": "module",

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

dependencies Pull requests that update a dependency file size/s

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants