Skip to content

There can be more than Notion and Miro. AFFiNE(pronounced [ə‘fain]) is a next-gen knowledge base that brings planning, sorting and creating all together. Privacy first, open-source, customizable and ready to use.

chore: update runtime (#3312)

Alex Yangae182bfd785f
diff --git a/apps/core/.webpack/config.ts b/apps/core/.webpack/config.ts
index 2ad658a2f5..22b08fc63f 100644
--- a/apps/core/.webpack/config.ts
+++ b/apps/core/.webpack/config.ts
@@ -249,7 +249,7 @@ export const createConfiguration: (
inject: 'body',
scriptLoading: 'defer',
minify: false,
- chunks: ['index'],
+ chunks: ['index', 'plugin'],
filename: 'index.html',
}),
new MiniCssExtractPlugin({
diff --git a/apps/core/.webpack/webpack.config.ts b/apps/core/.webpack/webpack.config.ts
index 5e43fb2c6c..9c58cf63cc 100644
--- a/apps/core/.webpack/webpack.config.ts
+++ b/apps/core/.webpack/webpack.config.ts
@@ -15,9 +15,14 @@ export default async function (cli_env: any, _: any) {
return merge(config, {
entry: {
index: {
- asyncChunks: true,
+ asyncChunks: false,
import: resolve(rootPath, 'src/index.tsx'),
},
+ plugin: {
+ dependOn: ['index'],
+ asyncChunks: true,
+ import: resolve(rootPath, 'src/bootstrap/register-plugins.ts'),
+ },
},
});
}
diff --git a/apps/core/src/bootstrap/before-app.ts b/apps/core/src/bootstrap/before-app.ts
index 94b8d401f2..526faef857 100644
--- a/apps/core/src/bootstrap/before-app.ts
+++ b/apps/core/src/bootstrap/before-app.ts
@@ -21,6 +21,7 @@ import { rootStore } from '@toeverything/plugin-infra/manager';
import { WorkspaceAdapters } from '../adapters/workspace';
+console.log('setup global');
setupGlobal();
rootStore.set(
diff --git a/apps/core/src/bootstrap/register-plugins.ts b/apps/core/src/bootstrap/register-plugins.ts
index fe7b54f107..15d6eec7ed 100644
--- a/apps/core/src/bootstrap/register-plugins.ts
+++ b/apps/core/src/bootstrap/register-plugins.ts
@@ -3,4 +3,4 @@ if (runtimeConfig.enablePlugin) {
import('@affine/copilot');
}
-export {};
+console.log('register plugins finished');
diff --git a/apps/core/src/index.tsx b/apps/core/src/index.tsx
index d2ba1cbee0..741c8e61fd 100644
--- a/apps/core/src/index.tsx
+++ b/apps/core/src/index.tsx
@@ -8,7 +8,6 @@ async function main() {
assertExists(root);
createRoot(root).render(<App />);
- await import('./bootstrap/register-plugins');
}
await main();
diff --git a/apps/electron/src/main/index.ts b/apps/electron/src/main/index.ts
index d50609d1dd..34c61f11d7 100644
--- a/apps/electron/src/main/index.ts
+++ b/apps/electron/src/main/index.ts
@@ -12,6 +12,8 @@ import { registerPlugin } from './plugin';
import { registerProtocol } from './protocol';
import { registerUpdater } from './updater';
+app.enableSandbox();
+
if (require('electron-squirrel-startup')) app.quit();
// allow tests to overwrite app name through passing args
if (process.argv.includes('--app-name')) {