You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am trying to use the JsonDB in a electron package compiled via rollup but it seems I am unable to export the JsonDB object / methods. Can someone please take a look and let me know what the issue could be?
db.js
'use strict'
import { JsonDB } from 'node-json-db';
import { Config } from 'node-json-db/dist/lib/JsonDBConfig'
const log = require('../logger/logger');
let db;
if (process.env.NODE_ENV == 'production') {
try {
db = new JsonDB(new Config(process.env.DBPATH_PROD, true, true, '/'));
} catch (error) {
log.error("Database file not found: " + error)
}
}
else {
try {
db = new JsonDB(new Config(process.env.DBPATH_DEV, true, true, '/'));
} catch (error) {
log.error("Database file not found: " + error)
}
}
exports.db = db;
controller.js
let jsonDB = require('./database/db.js')
var testData = jsonDB.db.getData('/data/test')
console.log(testData)
Error
`App threw an error during load
TypeError: Cannot read properties of undefined (reading 'getData')
`
The text was updated successfully, but these errors were encountered:
Hello,
I am trying to use the JsonDB in a electron package compiled via rollup but it seems I am unable to export the JsonDB object / methods. Can someone please take a look and let me know what the issue could be?
db.js
controller.js
Error
The text was updated successfully, but these errors were encountered: