Skip to content
Advertisement

In JS can I require() only an export from a module?

In other words can I do this :

import Binance from 'binance-api-node'

const client = Binance()

with a require() statement ??

The above code needs to be in a small module I have to write so I cannot use import

Advertisement

Answer

const Binance = require('binance-api-node').default;

const client = Binance();
User contributions licensed under: CC BY-SA
3 People found this is helpful
Advertisement