Closed awweather closed 3 years ago
What version of node?
To run my code I'm also using ts-node:
node --loader ts-node/esm src/main.ts
Snippet from my package.json:
"type": "module",
"dependencies": {
"@master-chief/alpaca": "^6.1.2"
}
My node version is v14.7.0
but unlike you I do not use commonjs
for my compilerOptions, I use esnext
. If you wish to use commonjs
you can import a direct path to the dist/cjs/index.js
folder or one of the bundles.
I should probably showcase different styles of imports on the README thank you for opening the issue.
Good call, I was on an older version of node. Updated to the most recent stable and it's working now.
Sorry for the confusion! But maybe it'll help someone that runs into a similar issue
Hi,
I have a typescript node project. I've used NPM to install the module.
Using
import { AlpacaClient, AlpacaStream } from "@master-chief/alpaca";
gives me the error below:It appears it's trying to use the index.js from the dist/mjs folder, although my module config in compiler options is set to use commonjs. Any idea on how I can get this working? Should I be using one of the bundles?