Skip to content

Module ResolutionΒ #92

@richb-rv

Description

@richb-rv

Describe the bug
Seeing a module resolution bug implementing in Cursor, it looks like the package imports ES modules as named imports from what Node treats as CommonJS modules.

import {AgentFocus} from '../../node_modules/chrome-devtools-frontend/front_end/models/ai_assistance/performance/AIContext.js';
        ^^^^^^^^^^
SyntaxError: Named export 'AgentFocus' not found. The requested module '../../node_modules/chrome-devtools-frontend/front_end/models/ai_assistance/performance/AIContext.js' is a CommonJS module, which may not support all module.exports as named exports.
CommonJS modules can always be imported via the default export, for example using:

import pkg from '../../node_modules/chrome-devtools-frontend/front_end/models/ai_assistance/performance/AIContext.js';
const {AgentFocus} = pkg;

    at ModuleJob._instantiate (node:internal/modules/esm/module_job:134:21)
    at async ModuleJob.run (node:internal/modules/esm/module_job:217:5)
    at async ModuleLoader.import (node:internal/modules/esm/loader:316:24)
    at async asyncRunEntryPointWithESMLoader (node:internal/modules/run_main:123:5)

To Reproduce
Steps to reproduce the behavior:

  1. Add
"chrome-devtools": {
     "command": "npx",
     "args": ["chrome-devtools-mcp@latest"]
   }

to mcp file for Cursor

  1. or run npx chrome-devtools-mcp@latest --help
  2. See error

Expected behavior
MCP server has tools available

Chrome version: 140.0.7339.133
Coding agent version: latest
Node version: v20.16.0
Cursor version: v1.6.45

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions