From 95673b0131ba17206134cae00b4b98364e9f7c48 Mon Sep 17 00:00:00 2001
From: David Sehnal <david.sehnal@gmail.com>
Date: Fri, 17 Apr 2020 19:10:05 +0200
Subject: [PATCH] do not build browserTests in production build, added
 build-viewer task - reduced the production build time by several minutes  
 (it took 30+s for each "subproject" and webpack was building them linearly)

---
 package.json                 | 4 +++-
 webpack.config.production.js | 9 +++++++++
 2 files changed, 12 insertions(+), 1 deletion(-)
 create mode 100644 webpack.config.production.js

diff --git a/package.json b/package.json
index a0c699305..bf8c34938 100644
--- a/package.json
+++ b/package.json
@@ -15,9 +15,11 @@
     "lint-fix": "eslint ./**/*.{ts,tsx} --fix",
     "test": "npm run lint && jest",
     "build": "npm run build-tsc && npm run build-extra && npm run build-webpack",
+    "build-viewer": "npm run build-tsc && npm run build-extra && npm run build-webpack-viewer",
     "build-tsc": "tsc --incremental && tsc --build src/servers --incremental",
     "build-extra": "cpx \"src/**/*.{scss,html,ico}\" lib/",
-    "build-webpack": "webpack --mode production",
+    "build-webpack": "webpack --mode production --config ./webpack.config.production.js",
+    "build-webpack-viewer": "webpack --mode production --config ./webpack.config.viewer.js",
     "watch": "concurrently -c \"green,green,gray,gray\" --names \"tsc,srv,ext,wpc\" --kill-others \"npm:watch-tsc\" \"npm:watch-servers\" \"npm:watch-extra\" \"npm:watch-webpack\"",
     "watch-viewer": "concurrently -c \"green,gray,gray\" --names \"tsc,ext,wpc\" --kill-others \"npm:watch-tsc\" \"npm:watch-extra\" \"npm:watch-webpack-viewer\"",
     "watch-viewer-debug": "concurrently -c \"green,gray,gray\" --names \"tsc,ext,wpc\" --kill-others \"npm:watch-tsc\" \"npm:watch-extra\" \"npm:watch-webpack-viewer-debug\"",
diff --git a/webpack.config.production.js b/webpack.config.production.js
new file mode 100644
index 000000000..c46bfcfd1
--- /dev/null
+++ b/webpack.config.production.js
@@ -0,0 +1,9 @@
+const { createApp, createExample } = require('./webpack.config.common.js');
+
+const apps = ['viewer'];
+const examples = ['proteopedia-wrapper', 'basic-wrapper', 'lighting'];
+
+module.exports = [
+    ...apps.map(createApp),
+    ...examples.map(createExample)
+]
\ No newline at end of file
-- 
GitLab