-
Notifications
You must be signed in to change notification settings - Fork 566
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Help] 如何在 Vue 组件中使用fs模块? #489
Comments
node:fs在主进程使用,然后通过通信把数据传到渲染进行。 |
同问,问题解决了吗 |
你可以看下这个 https://github.com/caoxiemeihao/electron-vite-samples/tree/main/sqlite3-renderer-process, 在serialport-renderer-process/src/main.ts目录尝试使用。 fs.mkdir('file').catch(() => {
console.log('data directory already exists')
}) |
你说的这个sqlite3-renderer-process引入fs之类的是没有报错的,但是electron-vite-vue引入就是报错Dynamic require of |
没看明白~能发一下你修改后的demo吗
PL
***@***.***
…------------------ 原始邮件 ------------------
发件人: "electron-vite/electron-vite-vue" ***@***.***>;
发送时间: 2024年5月17日(星期五) 中午1:38
***@***.***>;
***@***.******@***.***>;
主题: Re: [electron-vite/electron-vite-vue] [Help] 如何在 Vue 组件中使用fs模块? (Issue #489)
你用这个试一下:https://github.com/caoxiemeihao/electron-vite-samples/blob/main/sqlite3-renderer-process/vite.config.ts#L3
https://github.com/electron-vite/vite-plugin-electron/blob/f6dabc3cf4da2244006a3b8e15a102a167dd155d/src/simple.ts#L63
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you commented.Message ID: ***@***.***>
|
碰到同样的问题, 按照此方法必然复现该问题, 烦劳开发组关注一下.
另外, 按照 "RSS1102"的说法, 是不是就不应该在渲染进程使用 node:fs ? |
按照推荐来,不要在渲染进程使用 node:fs |
关闭进程隔离contextIsolation: false, |
src\views\Index.vue
electron\main\index.ts
console
求教!
The text was updated successfully, but these errors were encountered: