diff --git a/build.js b/build.js index a6732b424..4f637373e 100755 --- a/build.js +++ b/build.js @@ -1,9 +1,9 @@ #!/usr/bin/env node import fs from 'node:fs'; +import os from 'node:os'; import copy from 'esbuild-plugin-copy'; -import esbuild from "esbuild"; import { cockpitCompressPlugin } from './pkg/lib/esbuild-compress-plugin.js'; import { cockpitPoEsbuildPlugin } from './pkg/lib/cockpit-po-plugin.js'; @@ -13,6 +13,9 @@ import { eslintPlugin } from './pkg/lib/esbuild-eslint-plugin.js'; import { stylelintPlugin } from './pkg/lib/esbuild-stylelint-plugin.js'; import { esbuildStylesPlugins } from './pkg/lib/esbuild-common.js'; +const useWasm = os.arch() !== 'x64'; +const esbuild = (await import(useWasm ? 'esbuild-wasm' : 'esbuild')); + const production = process.env.NODE_ENV === 'production'; const watchMode = process.env.ESBUILD_WATCH === "true" || false; // linters dominate the build time, so disable them for production builds by default, but enable in watch mode diff --git a/node_modules b/node_modules index 8ae4d6251..a7b7b139b 160000 --- a/node_modules +++ b/node_modules @@ -1 +1 @@ -Subproject commit 8ae4d6251770efdf033649ec40c23b22396da772 +Subproject commit a7b7b139b2af4a006842fe006ab82e8285e6a4e9 diff --git a/package.json b/package.json index a7bb94a90..c7a99f3a4 100644 --- a/package.json +++ b/package.json @@ -17,10 +17,11 @@ "devDependencies": { "argparse": "^2.0.1", "chrome-remote-interface": "^0.32.1", - "esbuild": "0.17.10", + "esbuild": "^0.17.16", "esbuild-plugin-copy": "^2.0.2", "esbuild-plugin-replace": "^1.3.0", "esbuild-sass-plugin": "2.6.0", + "esbuild-wasm": "^0.17.16", "eslint": "^8.29.0", "eslint-config-standard": "^17.0.0", "eslint-config-standard-jsx": "^11.0.0",