diff --git a/App/nodemon.json b/App/nodemon.json index c8df815972..6c7778d37a 100644 --- a/App/nodemon.json +++ b/App/nodemon.json @@ -16,5 +16,5 @@ "TS_NODE_TRANSPILE_ONLY": "1", "TS_NODE_FILES": "false" }, - "exec": "node -r ts-node/register/transpile-only Index.ts" -} \ No newline at end of file + "exec": "node --no-node-snapshot -r ts-node/register/transpile-only Index.ts" +} diff --git a/App/package.json b/App/package.json index 1727acd362..201f06f72a 100644 --- a/App/package.json +++ b/App/package.json @@ -26,7 +26,7 @@ "watch-frontend:status-page": "bash ./scripts/frontend-run.sh FeatureSet/StatusPage dev-build --watch", "watch-frontend:public-dashboard": "bash ./scripts/frontend-run.sh FeatureSet/PublicDashboard dev-build --watch", "dev:api": "npx nodemon", - "start": "export NODE_OPTIONS='--max-old-space-size=8096' && node --require ts-node/register Index.ts", + "start": "export NODE_OPTIONS='--max-old-space-size=8096' && node --no-node-snapshot --require ts-node/register Index.ts", "compile": "tsc", "clear-modules": "rm -rf node_modules && rm package-lock.json && npm install", "dev": "bash ./scripts/dev.sh", diff --git a/App/scripts/dev.sh b/App/scripts/dev.sh index 780b3b424c..d26c3e36ec 100644 --- a/App/scripts/dev.sh +++ b/App/scripts/dev.sh @@ -31,6 +31,8 @@ pids+=($!) npm run watch-frontend:public-dashboard & pids+=($!) +bash ./scripts/prepare-native-deps.sh + npm run dev:api & pids+=($!) diff --git a/App/scripts/prepare-native-deps.sh b/App/scripts/prepare-native-deps.sh new file mode 100644 index 0000000000..a44713f663 --- /dev/null +++ b/App/scripts/prepare-native-deps.sh @@ -0,0 +1,26 @@ +#!/usr/bin/env bash + +set -euo pipefail + +common_dir="/usr/src/Common" + +if [ ! -d "${common_dir}/node_modules/isolated-vm" ]; then + echo "Installing Common dependencies..." + npm --prefix "${common_dir}" install +fi + +if ( + cd "${common_dir}" && + node --no-node-snapshot -e "require('isolated-vm')" +) >/dev/null 2>&1; then + exit 0 +fi + +echo "Rebuilding isolated-vm for Node $(node -p 'process.version')..." + +npm --prefix "${common_dir}" rebuild isolated-vm + +( + cd "${common_dir}" && + node --no-node-snapshot -e "require('isolated-vm')" +) >/dev/null