node-talib icon indicating copy to clipboard operation
node-talib copied to clipboard

How do I correctly import talib in my svelltekit project?

Open AhegaoBurger opened this issue 1 year ago • 1 comments

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

AhegaoBurger avatar Jan 09 '24 00:01 AhegaoBurger

This needs to run on server side.

oransel avatar Mar 27 '24 20:03 oransel