node-talib
node-talib copied to clipboard
How do I correctly import talib in my svelltekit project?
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
This needs to run on server side.