Browse Source

build(dev): Make UI hot reload default enabled (#21694)

This has been working pretty well, so lets make it default enabled (provided you are using `direnv`)
Billy Vong 4 years ago
parent
commit
7011bc8160
4 changed files with 13 additions and 11 deletions
  1. 4 0
      .envrc
  2. 4 4
      Makefile
  3. 3 1
      package.json
  4. 2 6
      tests/acceptance/conftest.py

+ 4 - 0
.envrc

@@ -95,6 +95,10 @@ export PIP_DISABLE_PIP_VERSION_CHECK=on
 # increase node's memory limit, required for our webpacking
 export NODE_OPTIONS=--max-old-space-size=4096
 
+# Frontend hot module reloader using `react-refresh`
+# Enable this by default for development envs (CI/deploys do not use envrc)
+export SENTRY_UI_HOT_RELOAD=1
+
 ### System ###
 
 for pkg in \

+ 4 - 4
Makefile

@@ -1,5 +1,5 @@
 PIP := python -m pip --disable-pip-version-check
-WEBPACK := NODE_ENV=production yarn webpack
+WEBPACK := yarn build-acceptance
 
 # Currently, this is only required to install black via pre-commit.
 REQUIRED_PY3_VERSION := $(shell awk 'FNR == 2' .python-version)
@@ -145,7 +145,7 @@ test-js-build: node-version-check
 	@echo "--> Running type check"
 	@yarn run tsc -p config/tsconfig.build.json
 	@echo "--> Building static assets"
-	@$(WEBPACK) --profile --json > .artifacts/webpack-stats.json
+	@NODE_ENV=production yarn webpack-profile > .artifacts/webpack-stats.json
 
 test-js: node-version-check
 	@echo "--> Running JavaScript tests"
@@ -180,12 +180,12 @@ test-symbolicator:
 
 test-acceptance: node-version-check
 	@echo "--> Building static assets"
-	@$(WEBPACK) --display errors-only
+	@$(WEBPACK)
 	make run-acceptance
 
 test-plugins:
 	@echo "--> Building static assets"
-	@$(WEBPACK) --display errors-only
+	@$(WEBPACK)
 	@echo "--> Running plugin tests"
 	py.test tests/sentry_plugins -vv --cov . --cov-report="xml:.artifacts/plugins.coverage.xml" --junit-xml=".artifacts/plugins.junit.xml" || exit 1
 	@echo ""

+ 3 - 1
package.json

@@ -209,7 +209,9 @@
     "build-derefed-docs": "node api-docs/index.js api-docs/openapi.json",
     "watch-api-docs": "sane 'yarn build-derefed-docs' api-docs",
     "build-css": "NODE_ENV=production yarn webpack --config=config/webpack.css.config.js",
-    "build": "NODE_ENV=production yarn webpack --mode production --display errors-only --output-path=public",
+    "build-acceptance": "yarn build-production",
+    "build-production": "NODE_ENV=production yarn webpack --mode production --display errors-only",
+    "build": "yarn build-production --output-path=public",
     "validate-api-examples": "openapi-examples-validator ./api-docs/openapi.json --no-additional-properties"
   },
   "volta": {

+ 2 - 6
tests/acceptance/conftest.py

@@ -59,12 +59,8 @@ def pytest_configure(config):
 
     try:
         status = subprocess.call(
-            ["yarn", "--silent", "webpack"],
-            env={
-                "NODE_ENV": "development",
-                "PATH": os.environ["PATH"],
-                "NODE_OPTIONS": "--max-old-space-size=4096",
-            },
+            ["yarn", "build-acceptance"],
+            env={"PATH": os.environ["PATH"], "NODE_OPTIONS": "--max-old-space-size=4096"},
         )
 
         if status != 0: