Skip to content

Commit

Permalink
Add esbuild-wasm to allow build in non x86 platforms
Browse files Browse the repository at this point in the history
  • Loading branch information
subhoghoshX authored and martinpitt committed Apr 16, 2023
1 parent ece402d commit 0ecb544
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
5 changes: 4 additions & 1 deletion build.js
Original file line number Diff line number Diff line change
@@ -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';
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion node_modules
Submodule node_modules updated 109 files
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down

0 comments on commit 0ecb544

Please sign in to comment.