-
Notifications
You must be signed in to change notification settings - Fork 92
Closed
Description
config/plugin.ts
import { EggPlugin } from 'egg';
const plugin: EggPlugin = {}
export default pluginpackage.json
{
"type": "module"
}errors in terminal
2025-03-11 19:19:16,497 ERROR 97119 nodejs.ERR_REQUIRE_ESMError: [egg-core] load file: /Users/macbookpro/Documents/zmn/zmn-rww-mcp/config/plugin.ts, error: Must use import to load ES Module: /Users/macbookpro/Documents/zmn/zmn-rww-mcp/config/plugin.ts
require() of ES modules is not supported.
require() of /Users/macbookpro/Documents/zmn/zmn-rww-mcp/config/plugin.ts from /Users/macbookpro/Documents/zmn/zmn-rww-mcp/node_modules/egg-core/lib/utils/index.js is an ES module file as it is a .ts file whose nearest parent package.json contains "type": "module" which defines all .ts files in that package scope as ES modules.
Instead change the requiring code to use import(), or remove "type": "module" from /Users/macbookpro/Documents/zmn/zmn-rww-mcp/package.json.
require() of ES modules is not supported.Metadata
Metadata
Assignees
Labels
No labels