diff --git a/.npmrc b/.npmrc index cffe8cdef13..421cf18217d 100644 --- a/.npmrc +++ b/.npmrc @@ -1 +1,4 @@ save-exact=true +# Increase available heap size to avoid running out of memory when compiling. +# This applies to all npm scripts in this repository. +node-options=--max-old-space-size=8192 \ No newline at end of file diff --git a/apps/cli/package.json b/apps/cli/package.json index 8c5b367cb61..0a6707b4c64 100644 --- a/apps/cli/package.json +++ b/apps/cli/package.json @@ -18,14 +18,14 @@ "license": "SEE LICENSE IN LICENSE.txt", "scripts": { "clean": "rimraf dist", - "build:oss": "cross-env NODE_OPTIONS=\"--max-old-space-size=8192\" webpack", + "build:oss": "webpack", "build:oss:debug": "npm run build:oss && node --inspect ./build/bw.js", "build:oss:watch": "webpack --watch", "build:oss:prod": "cross-env NODE_ENV=production webpack", "build:oss:prod:watch": "cross-env NODE_ENV=production webpack --watch", "debug": "node --inspect ./build/bw.js", "publish:npm": "npm run build:oss:prod && npm publish --access public", - "build:bit": "cross-env NODE_OPTIONS=\"--max-old-space-size=8192\" webpack -c ../../bitwarden_license/bit-cli/webpack.config.js", + "build:bit": "webpack -c ../../bitwarden_license/bit-cli/webpack.config.js", "build:bit:debug": "npm run build:bit && node --inspect ./build/bw.js", "build:bit:watch": "webpack --watch -c ../../bitwarden_license/bit-cli/webpack.config.js", "build:bit:prod": "cross-env NODE_ENV=production npm run build:bit", diff --git a/apps/desktop/package.json b/apps/desktop/package.json index df79a106393..eee422d88a3 100644 --- a/apps/desktop/package.json +++ b/apps/desktop/package.json @@ -19,7 +19,7 @@ "postinstall": "electron-rebuild", "start": "cross-env ELECTRON_IS_DEV=0 ELECTRON_NO_UPDATER=1 electron ./build", "build-native": "cd desktop_native && node build.js", - "build": "cross-env NODE_OPTIONS=\"--max-old-space-size=8192\" concurrently -n Main,Rend,Prel -c yellow,cyan \"npm run build:main\" \"npm run build:renderer\" \"npm run build:preload\"", + "build": "concurrently -n Main,Rend,Prel -c yellow,cyan \"npm run build:main\" \"npm run build:renderer\" \"npm run build:preload\"", "build:dev": "concurrently -n Main,Rend -c yellow,cyan \"npm run build:main:dev\" \"npm run build:renderer:dev\"", "build:preload": "cross-env NODE_ENV=production webpack --config webpack.preload.js", "build:preload:watch": "cross-env NODE_ENV=production webpack --config webpack.preload.js --watch", diff --git a/apps/web/package.json b/apps/web/package.json index 115a508aff9..2aca101130d 100644 --- a/apps/web/package.json +++ b/apps/web/package.json @@ -2,10 +2,10 @@ "name": "@bitwarden/web-vault", "version": "2025.8.1", "scripts": { - "build:oss": "cross-env NODE_OPTIONS=\"--max-old-space-size=8192\" webpack", - "build:bit": "cross-env NODE_OPTIONS=\"--max-old-space-size=8192\" webpack -c ../../bitwarden_license/bit-web/webpack.config.js", - "build:oss:watch": "cross-env NODE_OPTIONS=\"--max-old-space-size=8192\" webpack serve", - "build:bit:watch": "cross-env NODE_OPTIONS=\"--max-old-space-size=8192\" webpack serve -c ../../bitwarden_license/bit-web/webpack.config.js", + "build:oss": "webpack", + "build:bit": "webpack -c ../../bitwarden_license/bit-web/webpack.config.js", + "build:oss:watch": "webpack serve", + "build:bit:watch": "webpack serve -c ../../bitwarden_license/bit-web/webpack.config.js", "build:bit:dev": "cross-env ENV=development npm run build:bit", "build:bit:dev:analyze": "cross-env LOGGING=false webpack -c ../../bitwarden_license/bit-web/webpack.config.js --profile --json > stats.json && npx webpack-bundle-analyzer stats.json build/", "build:bit:dev:watch": "cross-env ENV=development NODE_OPTIONS=\"--max-old-space-size=8192\" npm run build:bit:watch", diff --git a/package.json b/package.json index bf6be11a616..d670ca2d002 100644 --- a/package.json +++ b/package.json @@ -25,9 +25,9 @@ "test:locales": "tsc --project ./scripts/tsconfig.json && node ./scripts/dist/test-locales.js", "lint:dep-ownership": "tsc --project ./scripts/tsconfig.json && node ./scripts/dist/dep-ownership.js", "docs:json": "compodoc -p ./tsconfig.json -e json -d . --disableRoutesGraph", - "storybook": "cross-env NODE_OPTIONS=\"--max-old-space-size=8192\" ng run components:storybook", - "build-storybook": "cross-env NODE_OPTIONS=\"--max-old-space-size=8192\" ng run components:build-storybook", - "build-storybook:ci": "cross-env NODE_OPTIONS=\"--max-old-space-size=8192\" ng run components:build-storybook --webpack-stats-json", + "storybook": "ng run components:storybook", + "build-storybook": "ng run components:build-storybook", + "build-storybook:ci": "ng run components:build-storybook --webpack-stats-json", "test-stories": "test-storybook --url http://localhost:6006", "test-stories:watch": "test-stories --watch" },