mirror of
https://github.com/WeBankFinTech/fes.js.git
synced 2025-04-06 03:59:53 +08:00
fix: 修复vite热更新问题
This commit is contained in:
parent
b12f86bbbf
commit
7da7a348e2
@ -36,16 +36,21 @@ export default function (api) {
|
|||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const cacheCopyPath = {};
|
||||||
|
|
||||||
api.registerMethod({
|
api.registerMethod({
|
||||||
name: 'copyTmpFiles',
|
name: 'copyTmpFiles',
|
||||||
fn({ namespace, path, ignore }) {
|
fn({ namespace, path, ignore }) {
|
||||||
|
const base = join(api.paths.absTmpPath, namespace);
|
||||||
|
// copy 行为只需要执行一次
|
||||||
|
if (cacheCopyPath[base]) return;
|
||||||
|
cacheCopyPath[base] = true;
|
||||||
assert(api.stage >= api.ServiceStage.pluginReady, 'api.copyTmpFiles() should not execute in register stage.');
|
assert(api.stage >= api.ServiceStage.pluginReady, 'api.copyTmpFiles() should not execute in register stage.');
|
||||||
assert(path, 'api.copyTmpFiles() should has param path');
|
assert(path, 'api.copyTmpFiles() should has param path');
|
||||||
assert(namespace, 'api.copyTmpFiles() should has param namespace');
|
assert(namespace, 'api.copyTmpFiles() should has param namespace');
|
||||||
const files = api.utils.glob.sync('**/*', {
|
const files = api.utils.glob.sync('**/*', {
|
||||||
cwd: path,
|
cwd: path,
|
||||||
});
|
});
|
||||||
const base = join(api.paths.absTmpPath, namespace);
|
|
||||||
files.forEach((file) => {
|
files.forEach((file) => {
|
||||||
const source = join(path, file);
|
const source = join(path, file);
|
||||||
const target = join(base, file);
|
const target = join(base, file);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user