Comments (9)
我是在主进程使用的execa,并不是在渲染进程,渲染进程ipc调用主进程里的execa
主要进程使用 execa 不用装 vite-plugin-esmodule
这块设计失误。。。
我更新个版本,你稍微当我一小会儿。。。
from electron-vite-boilerplate.
代码已经更新 :)
from electron-vite-boilerplate.
在主进程中,我的execa使用方式
import {execa, Options} from 'execa'
async function _execa(file: string,
arguments?: readonly string[],
options?: Options<null>) {
const {stdout} = await execa(file, arguments, options)
console.log(stdout)
}
from electron-vite-boilerplate.
你确定你的项目在渲染进程开启了 Node.js 能力?
webPreferences: {
contextIsolation: false,
nodeIntegration: true,
},
from electron-vite-boilerplate.
你确定你再渲染进程开启了 Node.js 能力?
我是在主进程使用的execa,并不是在渲染进程,渲染进程ipc调用主进程里的execa
from electron-vite-boilerplate.
nodeIntegration
from electron-vite-boilerplate.
你确定你的项目在渲染进程开启了 Node.js 能力?
webPreferences: { contextIsolation: false, nodeIntegration: true, },
from electron-vite-boilerplate.
packages/main/vite.config.ts
rollupOptions: {
external: [
'electron',
...builtinModules,
+ ...builtinModules.map(e => `node:${e}`),
...Object.keys(pkg.dependencies || {}),
],
},
- 把
execa
放到devDependencies
这么两步就能用了,你先这么用着;我有事今天不搞了,明天再说。。。
from electron-vite-boilerplate.
packages/main/vite.config.ts
rollupOptions: { external: [ 'electron', ...builtinModules, + ...builtinModules.map(e => `node:${e}`), ...Object.keys(pkg.dependencies || {}), ], },
- 把
execa
放到devDependencies
这么两步就能用了,你先这么用着;我有事今天不搞了,明天再说。。。
感谢!
from electron-vite-boilerplate.
Related Issues (9)
- 剔除 tsx 只保留最简单的 App.vue HelloWorld.vue,build 后启动时报错 HOT 2
- [Help] The task `start.debug.script.mjs`cannot be tracked. Make sure to have a problem matcher defined. HOT 4
- [Help] Cannot write file 'xxxx/electron-vite-boilerplate/dist/main/index.cjs' because it would overwrite input file. HOT 1
- 求助打包时svg-sprite-loader问题 HOT 1
- [Help] 如何设置环境变量? HOT 1
- systemPreferences support HOT 1
- Sharing types between main and renderer HOT 1
- serialport版本已经是10.3.0,已经自带类型且不支持默认导出,请问vite-plugin-electron-renderer中应该怎么写, HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from electron-vite-boilerplate.