mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-08-09 05:05:52 +08:00
build: fix arm64 mac build (#1704)
This commit is contained in:
@@ -139,7 +139,7 @@ jobs:
|
|||||||
path: apps/electron/dist
|
path: apps/electron/dist
|
||||||
|
|
||||||
- name: build octobase-node
|
- name: build octobase-node
|
||||||
run: yarn build:octobase-node
|
run: yarn build:octobase-node --target=aarch64-apple-darwin
|
||||||
working-directory: apps/electron
|
working-directory: apps/electron
|
||||||
|
|
||||||
- name: move octobase Binary
|
- name: move octobase Binary
|
||||||
|
|||||||
@@ -10,6 +10,16 @@ const { node } = JSON.parse(
|
|||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
const nativeNodeModulesPlugin = {
|
||||||
|
name: 'native-node-modules',
|
||||||
|
setup(build) {
|
||||||
|
// Mark native Node.js modules as external
|
||||||
|
build.onResolve({ filter: /\.node$/, namespace: 'file' }, args => {
|
||||||
|
return { path: args.path, external: true };
|
||||||
|
});
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
/** @type {import('esbuild').BuildOptions} */
|
/** @type {import('esbuild').BuildOptions} */
|
||||||
export const mainConfig = {
|
export const mainConfig = {
|
||||||
entryPoints: ['layers/main/src/index.ts'],
|
entryPoints: ['layers/main/src/index.ts'],
|
||||||
@@ -18,6 +28,7 @@ export const mainConfig = {
|
|||||||
target: `node${node}`,
|
target: `node${node}`,
|
||||||
platform: 'node',
|
platform: 'node',
|
||||||
external: ['electron'],
|
external: ['electron'],
|
||||||
|
plugins: [nativeNodeModulesPlugin],
|
||||||
};
|
};
|
||||||
|
|
||||||
export const preloadConfig = {
|
export const preloadConfig = {
|
||||||
|
|||||||
@@ -54,6 +54,7 @@ async function main() {
|
|||||||
const preloadBuild = await esbuild.context({
|
const preloadBuild = await esbuild.context({
|
||||||
...preloadConfig,
|
...preloadConfig,
|
||||||
plugins: [
|
plugins: [
|
||||||
|
...(preloadConfig.plugins ?? []),
|
||||||
{
|
{
|
||||||
name: 'affine-dev:reload-app-on-preload-change',
|
name: 'affine-dev:reload-app-on-preload-change',
|
||||||
setup(build) {
|
setup(build) {
|
||||||
@@ -86,6 +87,7 @@ async function main() {
|
|||||||
'process.env.DEV_SERVER_URL': `"${process.env.DEV_SERVER_URL}"`,
|
'process.env.DEV_SERVER_URL': `"${process.env.DEV_SERVER_URL}"`,
|
||||||
},
|
},
|
||||||
plugins: [
|
plugins: [
|
||||||
|
...(mainConfig.plugins ?? []),
|
||||||
{
|
{
|
||||||
name: 'affine-dev:reload-app-on-main-change',
|
name: 'affine-dev:reload-app-on-main-change',
|
||||||
setup(build) {
|
setup(build) {
|
||||||
|
|||||||
Reference in New Issue
Block a user