SyntaxError: The requested module 'steno' is expected to be of type CommonJS, which does not support named exports. CommonJS modules can be imported by importing the default export. #490
I am trying to create lowdb instance and I ran into this issue.
`
import low, { JSONFileSync } from 'lowdb';
import { chain } from 'lodash';
const adapter = new JSONFileSync('db.json');
const lowdb = new Low(adapter);
db.read();
if (!db.data) {
db.data = {};
db.write();
}
db.chain = chain(db.data);
`
(node:18820) ExperimentalWarning: The ESM module loader is experimental.
file:///C:/Spike%20Workspace/NodeJs/project/node_modules/lowdb/lib/esm/adapters/TextFile.js:2
import { Writer } from 'steno';
^^^^^^
SyntaxError: The requested module 'steno' is expected to be of type CommonJS, which does not support named exports. CommonJS modules can be imported by importing the default export.
For example:
import pkg from 'steno';
const { Writer } = pkg;
I am trying to create lowdb instance and I ran into this issue.
` import low, { JSONFileSync } from 'lowdb'; import { chain } from 'lodash';
const adapter = new JSONFileSync('db.json'); const lowdb = new Low(adapter); db.read(); if (!db.data) { db.data = {}; db.write(); } db.chain = chain(db.data); `
(node:18820) ExperimentalWarning: The ESM module loader is experimental. file:///C:/Spike%20Workspace/NodeJs/project/node_modules/lowdb/lib/esm/adapters/TextFile.js:2 import { Writer } from 'steno'; ^^^^^^ SyntaxError: The requested module 'steno' is expected to be of type CommonJS, which does not support named exports. CommonJS modules can be imported by importing the default export. For example: import pkg from 'steno'; const { Writer } = pkg;