mimecorg / vuido

Native desktop applications using Vue.js.

Home Page:https://vuido.mimec.org/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

How to use database with Vuido

sdkcodes opened this issue · comments

Hello, so I need to build a desktop work that needs to work without internet using Vuido, and I need a mechanism for storing data offline.

commented

You can use all libraries compatible with Node.js so if you want, for example, postgre you can install node-postgre

i am trying to use sqlite3.

when I run build or build:dev i get some errors:

`WARNING in ./node_modules/sqlite3/lib/sqlite3.js 4:14-35
Critical dependency: the request of a dependency is an expression
@ ./src/MainWindow.vue?vue&type=script&lang=js& (./node_modules/babel-loader/lib!./node_modules/vue-loader/lib??vue-loader-options!./src/MainWindow.vue?vue&type=script&lang=js&)
@ ./src/MainWindow.vue?vue&type=script&lang=js&
@ ./src/MainWindow.vue
@ ./src/main.js

WARNING in ./node_modules/node-pre-gyp/lib/pre-binding.js 20:22-48
Critical dependency: the request of a dependency is an expression
@ ./node_modules/node-pre-gyp/lib/node-pre-gyp.js
@ ./node_modules/sqlite3/lib/sqlite3.js
@ ./node_modules/babel-loader/lib!./node_modules/vue-loader/lib??vue-loader-options!./src/MainWindow.vue?vue&type=script&lang=js&
@ ./src/MainWindow.vue?vue&type=script&lang=js&
@ ./src/MainWindow.vue
@ ./src/main.js

WARNING in ./node_modules/node-pre-gyp/lib/util/versioning.js 17:20-67
Critical dependency: the request of a dependency is an expression
@ ./node_modules/node-pre-gyp/lib/pre-binding.js
@ ./node_modules/node-pre-gyp/lib/node-pre-gyp.js
@ ./node_modules/sqlite3/lib/sqlite3.js
@ ./node_modules/babel-loader/lib!./node_modules/vue-loader/lib??vue-loader-options!./src/MainWindow.vue?vue&type=script&lang=js&
@ ./src/MainWindow.vue?vue&type=script&lang=js&
@ ./src/MainWindow.vue
@ ./src/main.js

WARNING in ./node_modules/node-pre-gyp/lib/util/compile.js
Module not found: Error: Can't resolve 'npm' in 'C:\Users\rgalli\www\vuido\test\node_modules\node-pre-gyp\lib\util'
@ ./node_modules/node-pre-gyp/lib/util/compile.js
@ ./node_modules/node-pre-gyp/lib sync ^./.*$
@ ./node_modules/node-pre-gyp/lib/node-pre-gyp.js
@ ./node_modules/sqlite3/lib/sqlite3.js
@ ./node_modules/babel-loader/lib!./node_modules/vue-loader/lib??vue-loader-options!./src/MainWindow.vue?vue&type=script&lang=js&
@ ./src/MainWindow.vue?vue&type=script&lang=js&
@ ./src/MainWindow.vue
@ ./src/main.js

WARNING in ./node_modules/node-pre-gyp/lib/util/nw-pre-gyp/index.html 1:0
Module parse failed: Unexpected token (1:0)
You may need an appropriate loader to handle this file type.

<!doctype html>
|
|
@ ./node_modules/node-pre-gyp/lib sync ^./.*$ ./util/nw-pre-gyp/index.html
@ ./node_modules/node-pre-gyp/lib/node-pre-gyp.js
@ ./node_modules/sqlite3/lib/sqlite3.js
@ ./node_modules/babel-loader/lib!./node_modules/vue-loader/lib??vue-loader-options!./src/MainWindow.vue?vue&type=script&lang=js&
@ ./src/MainWindow.vue?vue&type=script&lang=js&
@ ./src/MainWindow.vue
@ ./src/main.js

WARNING in ./node_modules/node-gyp/lib/Find-VS2017.cs 7:6
Module parse failed: Unexpected token (7:6)
You may need an appropriate loader to handle this file type.
| // Usage:
| // powershell -ExecutionPolicy Unrestricted -Version "2.0" -Command "&{Add-Type -Path Find-VS2017.cs; [VisualStudioConfiguration.Main]::Query()}"

using System
| using System.Text
| using System.Runtime.InteropServices
@ ./node_modules/node-gyp/lib sync ^./.$ ./Find-VS2017.cs
@ ./node_modules/node-gyp/lib/node-gyp.js
@ ./node_modules/node-pre-gyp/lib/util/compile.js
@ ./node_modules/node-pre-gyp/lib sync ^./.
$
@ ./node_modules/node-pre-gyp/lib/node-pre-gyp.js
@ ./node_modules/sqlite3/lib/sqlite3.js
@ ./node_modules/babel-loader/lib!./node_modules/vue-loader/lib??vue-loader-options!./src/MainWindow.vue?vue&type=script&lang=js&
@ ./src/MainWindow.vue?vue&type=script&lang=js&
@ ./src/MainWindow.vue
@ ./src/main.js`

my environment

node: v10.15.1 npm: 6.4.1 windows: 10 visual studio code 2017

just solved this with a small webpack adjustment:
externals: { sqlite3: 'commonjs sqlite3' },