oransel / node-talib

A technical analysis library for node.js
GNU Lesser General Public License v3.0
894 stars 149 forks source link

How do I correctly import talib in my svelltekit project? #110

Closed AhegaoBurger closed 1 week ago

AhegaoBurger commented 6 months ago

I tried doing it the simple way: import talib from 'talib';

And got the result below:

[plugin:vite:import-analysis] Failed to parse source for import analysis because the content contains invalid JS syntax. You may need to install appropriate plugins to handle the .node file format, or if it's an asset, add "*/.node" to assetsInclude in your configuration. /home/artur/Documents/tradingDashboard/frontend/node_modules/talib/build/Release/talib.node

I also tried a way I saw in one of the issues:

import { createRequire } from "module";
const require = createRequire(import.meta.url);
const talib = require('talib');

And got this lovely result:

Failed to check condition for PRXUSDT: talib.EMA is not a function

oransel commented 3 months ago

This needs to run on server side.