Electron+Vue3+TS+sqlite3项目搭建加入sqlite3后无法运行问题

加入sqlite3测试代码后页面出现数不清的报错,这是因为vue配置中没有添加node支持

找到文件vue.config.js:4:1

// exports对象中加入配置


pluginOptions:{

electronBuilder:{

nodeIntegration:true

}

}


package.json


{

"name": "project",

"version": "0.1.0",

"private": true,

"scripts": {

"serve": "vue-cli-service serve",

"build": "vue-cli-service build",

"lint": "vue-cli-service lint",

"electron:build": "vue-cli-service electron:build",

"electron:serve": "vue-cli-service electron:serve",

"postinstall": "electron-builder install-app-deps",

"postuninstall": "electron-builder install-app-deps"

},

"main": "background.js",

"dependencies": {

"@types/sqlite3": "^3.1.8",

"core-js": "^3.8.3",

"sqlite3": "^5.0.0",

"vue": "^3.2.13",

"vue-router": "^4.0.3",

"vuex": "^4.0.0"

},

"devDependencies": {

"@types/electron-devtools-installer": "^2.2.0",

"@typescript-eslint/eslint-plugin": "^5.4.0",

"@typescript-eslint/parser": "^5.4.0",

"@vue/cli-plugin-babel": "~5.0.0",

"@vue/cli-plugin-eslint": "~5.0.0",

"@vue/cli-plugin-router": "~5.0.0",

"@vue/cli-plugin-typescript": "~5.0.0",

"@vue/cli-plugin-vuex": "~5.0.0",

"@vue/cli-service": "~5.0.0",

"@vue/eslint-config-typescript": "^9.1.0",

"electron": "^13.0.0",

"electron-devtools-installer": "^3.1.0",

"eslint": "^7.32.0",

"eslint-plugin-vue": "^8.0.3",

"sass": "^1.32.7",

"sass-loader": "^12.0.0",

"ts-loader": "^8.2.0",

"typescript": "~4.5.5",

"vue-cli-plugin-electron-builder": "~2.1.1"

}

}

参考链接:【Electron + Vue3 + TS + sqlite3项目搭建 - 杜柯枫 - 博客园】https://www.cnblogs.com/dkf717/p/17226481.html?_refluxos=a10

相关推荐
baozj4 分钟前
🚀 手动改 500 个文件?不存在的!我用 AST 撸了个 Vue 国际化神器
前端·javascript·vue.js
重铸码农荣光18 分钟前
从「[1,2,3].map (parseInt)」踩坑,吃透 JS 数组 map 与包装类核心逻辑
面试·node.js
molly cheung1 小时前
FetchAPI 请求流式数据 基本用法
javascript·fetch·请求取消·流式·流式数据·流式请求取消
Mintopia1 小时前
🧠 量子计算对AIGC的潜在影响:Web技术的未来可能性
前端·javascript·aigc
忧郁的蛋~2 小时前
.NET异步编程中内存泄漏的终极解决方案
开发语言·前端·javascript·.net
水月wwww2 小时前
vue学习之组件与标签
前端·javascript·vue.js·学习·vue
顾安r2 小时前
11.8 脚本网页 塔防游戏
服务器·前端·javascript·游戏·html
一 乐2 小时前
旅游|内蒙古景点旅游|基于Springboot+Vue的内蒙古景点旅游管理系统设计与实现(源码+数据库+文档)
开发语言·前端·数据库·vue.js·spring boot·后端·旅游
爱吃甜品的糯米团子3 小时前
JavaScript 正则表达式:选择、分组与引用深度解析
前端·javascript·正则表达式
星尘库3 小时前
抖音自动化-实现给特定用户发私信
前端·javascript·自动化