在构建时如何将自定义文件放入电子封装的根文件夹中?
我正在尝试将打包后的文件添加到我的电子应用程序的根目录。以下是我目前拥有的。它可以工作到一定程度,但是代码签名失败。
export const packagerOptions = {
name: 'app',
platform: 'win32',
arch: 'x64',
dir: path.join(__dirname, '../'),
out: path.join(__dirname, '../dist/packaged'),
ignore: [
/^\/(build|e2e|src)($|\/)/,
/^\/dist\/(installer|packaged)($|\/)/,
/^\/node_modules\/edge\/(build|test)($|\/)/,
/^\/node_modules\/edge\/.+\\.(dll|node)$/,
/^\/node_modules\/electron-edge-js\/(?!.+8\.9\.3).+\.(dll|node)$/,
],
icon: path.join(__dirname, '../assets/win32/app.ico'),
asar: {
unpack: '*.{dll,ico,node}'
},
prune: true,
overwrite: true,
win32metadata: {
CompanyName: 'App Co',
FileDescription: 'App Desktop',
ProductName: 'App Desktop',
InternalName: 'App Desktop'
},
afterExtract: [safeFFMPEG],
afterCopy: [serialHooks([
(buildPath, electronVersion, platform, arch, callback) => {
fs.copyFile(
path.join(__dirname, '../assets/extraResources/MYFILE'),
path.join(buildPath, '..', '..', 'MYFILE'),
err => console.log(err, 'an error occurred'));
}
])],
};
我尝试使用:
extraResource: [
path.join(__dirname, '../assets/extraResources/MYFILE')
],
但是将其放在资源/文件夹中。我需要将它放在资源的父文件夹中。