You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
root@2f3496033380:/app# node main.js
file:///app/main.js:1
import { DXLinkWebSocketClient, DXLinkFeed } from '@dxfeed/dxlink-api'
^^^^^^^^^^
SyntaxError: Named export 'DXLinkFeed' not found. The requested module '@dxfeed/dxlink-api' 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 '@dxfeed/dxlink-api';
const { DXLinkWebSocketClient, DXLinkFeed } = pkg;
at ModuleJob._instantiate (node:internal/modules/esm/module_job:146:21)
at async ModuleJob.run (node:internal/modules/esm/module_job:229:5)
at async ModuleLoader.import (node:internal/modules/esm/loader:473:24)
at async asyncRunEntryPointWithESMLoader (node:internal/modules/run_main:123:5)
Node.js v20.17.0
OK, so I should be able to do this then, right?
import dxLink from '@dxfeed/dxlink-api'
Nope:
/app/node_modules/@dxfeed/dxlink-api/build/index.module.js:1
export*from"@dxfeed/dxlink-core";export*from"@dxfeed/dxlink-feed";export*from"@dxfeed/dxlink-websocket-client";export*from"@dxfeed/dxlink-dom";
^^^^^^
SyntaxError: Unexpected token 'export'
at wrapSafe (node:internal/modules/cjs/loader:1378:20)
at Module._compile (node:internal/modules/cjs/loader:1428:41)
at Module._extensions..js (node:internal/modules/cjs/loader:1548:10)
at Module.load (node:internal/modules/cjs/loader:1288:32)
at Module._load (node:internal/modules/cjs/loader:1104:12)
at cjsLoader (node:internal/modules/esm/translators:346:17)
at ModuleWrap.<anonymous> (node:internal/modules/esm/translators:286:7)
at ModuleJob.run (node:internal/modules/esm/module_job:234:25)
at async ModuleLoader.import (node:internal/modules/esm/loader:473:24)
at async asyncRunEntryPointWithESMLoader (node:internal/modules/run_main:123:5)
The text was updated successfully, but these errors were encountered:
As @dxfeed/dxlink-api is an aggregate package, I also attempted to install @dxfeed/dxlink-websocket-client@0.3.0 and received the same inability to import the DXLinkWebSocketClient.
This package is unusable in its current state which is unfortunate.
I just came across the same problem while trying to use the package. Any updates from the devs?
Edit
Ended up just copying the source code of the individual packages: dxlink-core, dxlink-dom, dxlink-feed and dxlink-websocket-client into my project.
See sample project
Using the code in your README:
OK, so I should be able to do this then, right?
Nope:
The text was updated successfully, but these errors were encountered: