feat(electron): multi tabs support (#7440)

use https://www.electronjs.org/docs/latest/api/web-contents-view to serve different tab views
added tabs view manager in electron to handle multi-view actions and events.

fix AF-1111
fix AF-999
fix PD-1459
fix AF-964
PD-1458
This commit is contained in:
pengx17
2024-07-29 11:05:22 +00:00
parent 622715d2f3
commit 1efc1d0f5b
88 changed files with 3160 additions and 945 deletions

View File

@@ -33,23 +33,30 @@ export function createWebpackConfig(cwd: string, flags: BuildFlags) {
const runtimeConfig = getRuntimeConfig(flags);
console.log('runtime config', runtimeConfig);
const config = createConfiguration(cwd, flags, runtimeConfig);
const entry =
typeof flags.entry === 'string' || !flags.entry
? {
app: flags.entry ?? resolve(cwd, 'src/index.tsx'),
}
: flags.entry;
const createHTMLPlugin = (entryName = 'app') => {
return new HTMLPlugin({
template: join(rootPath, 'webpack', 'template.html'),
inject: 'body',
scriptLoading: 'module',
minify: false,
chunks: [entryName],
filename: `${entryName === 'app' ? 'index' : entryName}.html`, // main entry should take name index.html
templateParameters: {
GIT_SHORT_SHA: gitShortHash(),
DESCRIPTION,
},
});
};
return merge(config, {
entry: {
[flags.distribution]: flags.entry ?? resolve(cwd, 'src/index.tsx'),
},
plugins: [
new HTMLPlugin({
template: join(rootPath, 'webpack', 'template.html'),
inject: 'body',
scriptLoading: 'module',
minify: false,
chunks: 'all',
filename: 'index.html',
templateParameters: {
GIT_SHORT_SHA: gitShortHash(),
DESCRIPTION,
},
}),
],
entry: entry,
plugins: Object.keys(entry).map(createHTMLPlugin),
});
}