Skip to content

bug: knowledge.service.js fails to import loadSearchConfig from @user/knowledge-core (CJS/ESM named export mismatch) #128

Description

@dohapark81

Bug Report

Version: 0.8.0-rc.72
Platform: Windows (Node.js v22.22.2)

Error

file:///C:/Users/user/AppData/Local/nvm/v22.22.2/node_modules/crewx/dist-server/src/server/domain/knowledge/knowledge.service.js:10
import { parseFrontmatter as kcParseFrontmatter, searchEntries as kcSearchEntries, buildGraph as kcBuildGraph, loadSearchConfig, } from '@user/knowledge-core';
                                                                                                               ^^^^^^^^^^^^^^^^
SyntaxError: Named export 'loadSearchConfig' not found. The requested module '@user/knowledge-core' is a CommonJS module, which may not support all module.exports as named exports.

Root Cause

knowledge.service.ts uses ESM named imports from @user/knowledge-core which is a CommonJS module. Node.js cannot automatically resolve CJS module.exports as ESM named exports.

Fix Required

Change the import in knowledge.service.ts (and any other files with the same pattern):

Before (broken):

import { parseFrontmatter as kcParseFrontmatter, searchEntries as kcSearchEntries, buildGraph as kcBuildGraph, loadSearchConfig } from '@user/knowledge-core';

After (fixed):

import pkg from '@user/knowledge-core';
const { parseFrontmatter: kcParseFrontmatter, searchEntries: kcSearchEntries, buildGraph: kcBuildGraph, loadSearchConfig } = pkg as any;

Or alternatively, ensure @user/knowledge-core exports are ESM-compatible by adding a proper exports map.

Impact

crewx command crashes on startup. Server exits with code 1. Breaks all functionality.

Steps to Reproduce

  1. Install crewx 0.8.0-rc.72 globally
  2. Run crewx
  3. Server exits immediately with the above SyntaxError

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions