porosjs / poros

An electron react framework based on Umi-基于 Umi 的 Electron React 框架
MIT License
28 stars 0 forks source link

使用 chokidar来监听文件 运行出现错误 #2

Closed Ryan-cyi closed 2 months ago

Ryan-cyi commented 2 months ago

node: v20.17.0 system: mac

package:

{ "name": "demo", "version": "1.0.0", "private": true, "scripts": { "build:linux": "poros build --linux", "build:mac": "poros build --mac", "build:win": "poros build --win --x64 --ia32", "dev": "poros dev", "format": "prettier --cache --write .", "postinstall": "poros patch & poros setup", "prepare": "husky install", "rebuild-deps": "poros rebuild-deps", "setup": "poros setup", "start": "poros dev" }, "dependencies": { "@ant-design/icons": "^5.3.5", "@ant-design/plots": "^2.1.15", "antd": "^5.10.0", "chokidar": "^3.6.0", "lodash-es": "^4.17.21", "poros": "^1.1.7", "react": "^18.2.0", "react-dom": "^18.2.0", "systeminformation": "^5.22.6" }, "devDependencies": { "@electron/notarize": "^2.1.0", "@types/lodash-es": "^4.17.12", "@types/node": "^17.0.13", "@types/react": "^18.0.0", "@types/react-dom": "^18.0.0", "electron": "^29.0.0", "electron-builder": "^24.13.3", "electron-devtools-installer": "^3.2.0", "husky": "^8.0.1", "lint-staged": "^13.0.3", "prettier": "^3.0.3", "prettier-plugin-organize-imports": "^3.2.3", "prettier-plugin-packagejson": "^2.4.6", "tslib": "^2.6.2", "typescript": "5.1.6" } }


选择一个文件 进行监听 报错

mainWindows

@IpcHandle async openFile() { const result = await dialog.showOpenDialog({ properties: ['openFile'] }) if (!result.canceled && result.filePaths.length > 0) { const selectedFilePath = result.filePaths[0] const a = chokidar.watch(selectedFilePath) a.on('change', async (path) => { console.log('path', path) }) } return { code: -1, msg: '取消操作.' } } }

WangJM001 commented 2 months ago

刚看到反馈,还需要帮助不?可以贴下具体报了什么错

Ryan-cyi commented 2 months ago

不在了 每重新运行的时候 需要删除 .poros 文件 就可以了 。 另外咨询下 这个 升级相关的问题, 有集成lectron-updater么

WangJM001 commented 2 months ago

目前还没有,计划下个版本会集成😊

Ryan-cyi commented 2 months ago

嗯 期待 ...

WangJM001 commented 2 months ago

目前你也可以自己通过electron-updater来实现更新,集成后会考虑简化配置,包括mac签名啥的,快速开启升级功能! 使用中任何问题、建议,欢迎反馈沟通!🤝