diff --git a/README.md b/README.md index 82cb4b6..e10d533 100644 --- a/README.md +++ b/README.md @@ -38,6 +38,9 @@ node node_modules/@iobroker/build-tools/convertI18n.js path/to/i18n ### **WORK IN PROGRESS** --> ## Changelog +### **WORK IN PROGRESS** +* (bluefox) Added DANGEROUSLY_DISABLE_HOST_CHECK for buildReact + ### 1.0.2 (2024-09-10) * (bluefox) Added i18n convert script diff --git a/index.ts b/index.ts index 69bc86f..31420f8 100644 --- a/index.ts +++ b/index.ts @@ -13,6 +13,8 @@ import { type ChildProcess, exec, fork, type IOType, + type CommonSpawnOptions, + type ExecOptions, } from 'node:child_process'; import { dirname, join } from 'node:path'; @@ -252,11 +254,15 @@ export function buildReact( } return new Promise((resolve, reject) => { - const cpOptions = { + const cpOptions: CommonSpawnOptions = { stdio: 'pipe' as IOType, cwd: src, }; + cpOptions.env = { + DANGEROUSLY_DISABLE_HOST_CHECK: 'true', + }; + let script; if (options?.craco) { script = `${src}/node_modules/@craco/craco/dist/bin/craco.js`; @@ -291,7 +297,7 @@ export function buildReact( let child: ChildProcess; if (options?.ramSize || options?.exec) { const cmd = `node ${script}${options.ramSize ? ` --max-old-space-size=${options.ramSize}` : ''} build`; - child = exec(cmd, cpOptions); + child = exec(cmd, cpOptions as ExecOptions); } else { child = fork(script, ['build'], cpOptions); }