Skip to content
This repository has been archived by the owner on Jan 18, 2024. It is now read-only.

2.0 运行时,修改 main 端代码,将会自动结束进程 #30

Closed
arvinxx opened this issue Apr 23, 2021 · 3 comments
Closed

2.0 运行时,修改 main 端代码,将会自动结束进程 #30

arvinxx opened this issue Apr 23, 2021 · 3 comments

Comments

@arvinxx
Copy link

arvinxx commented Apr 23, 2021

用 example 中 main+renderer 案例试了下,当开启electron:dev ,然后修改 main 端任何代码后,会直接自动结束进程。这导致开发时每次都需要重开一遍 dev。

@arvinxx
Copy link
Author

arvinxx commented Apr 23, 2021

另外 demo 配置项有点问题,提 PR 了 #31

@BySlin
Copy link
Owner

BySlin commented Apr 23, 2021

watcher
.on('unlink', path => {
if (spawnProcess !== null && path.includes(getDevBuildDir(api))) {
spawnProcess.kill('SIGINT');
spawnProcess = null;
}
})
.on('add', path => {
if (path.includes(getDevBuildDir(api))) {
return runMain();
}
if (spawnProcess !== undefined && path.includes('preload.js')) {
return runPreload();
}
})
.on('change', (path) => {
if (path.includes(getMainSrc(api))) {
return buildMainDebounced();
}
if (path.includes('main.js')) {
return runMain();
}
if (path.includes(getPreloadSrc(api))) {
return buildPreloadDebounced();
}
if (path.includes('preload.js')) {
return runPreload();
}
});

在windows下是正常的,我手上没有mac,可能是这一段路径比较不正确

config.alias = config.alias || {};
config.alias['@/common'] = path.join(process.cwd(), 'src/common');

alias是默认配置的,我这边在windows下也是正常的

@BySlin
Copy link
Owner

BySlin commented Jun 7, 2021

此问题已修复

arvinxx added a commit to arvinxx/umi-electron-template that referenced this issue Jun 9, 2021
@BySlin BySlin closed this as completed Jun 10, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants