lowdb
lowdb copied to clipboard
Package subpath 'undefined' is not defined by "exports"
Error
[plugin:vite:import-analysis] Package subpath 'undefined' is not defined by "exports" in /Users/Documents/Project/test-statistics/node_modules/lowdb/package.json.
Package
"dependencies": {
"element-plus": "^2.2.14",
"pinia": "^2.0.9",
"vue": "^3.2.26",
"vue-router": "^4.0.12",
},
"devDependencies": {
"@cypress/vite-dev-server": "^2.2.2",
"@cypress/vue": "^3.1.0",
"@rushstack/eslint-patch": "^1.1.0",
"@types/node": "^16.11.17",
"@vitejs/plugin-vue": "^2.0.1",
"@vitejs/plugin-vue-jsx": "^1.3.3",
"@vue/eslint-config-prettier": "^7.0.0",
"@vue/eslint-config-typescript": "^10.0.0",
"cypress": "^9.2.0",
"eslint": "^8.5.0",
"eslint-plugin-cypress": "^2.12.1",
"eslint-plugin-vue": "^8.2.0",
"lowdb": "^3.0.0",
"prettier": "^2.5.1",
"typescript": "~4.5.4",
"vite": "^3.0.4",
"vue-tsc": "^0.29.8"
}
JS
import low from 'lowdb'
import LocalStorage from 'lowdb/adapters/LocalStorage'
const adapter = new LocalStorage(`lowdb-data`)
const db = low(adapter)
db.defaults({
dataList: []
}).write()
export default db
some help would be appreciated
I think you need to use the 3.0 syntax as described in the docs
Hi,
I've just published v5 which has been tested with Vite and should work. Feel free to reopen if it doesn't, I'll have a look.