Skip to content Skip to sidebar Skip to footer

Es6 Imports In Node With --experimental-modules

Trying to use ES6 imports in node with the -experimental-modules flag. Specifically: mkdir ma cd ma npm init npm i --save moving-averages touch index.mjs Now place the following

Solution 1:

Moving averages currently only has a single default export. You will need to import the whole module and then you have the option to de-structure the arguments.

import movingAverages from 'moving-averages'

const {ma, dma, ema, sma, wma} = movingAverages;

Post a Comment for "Es6 Imports In Node With --experimental-modules"