This is an automated email from the ASF dual-hosted git repository.

shuai pushed a commit to branch feat/1.3.0/ui
in repository https://gitbox.apache.org/repos/asf/incubator-answer.git

commit fd9d432d10c885087f568a6eba463b9bb1f6fda0
Author: shuai <[email protected]>
AuthorDate: Wed Mar 6 18:42:03 2024 +0800

    fix: optimize the configuration of setWebpackOptimizationSplitChunks #809 
#787
---
 ui/config-overrides.js  | 38 ++++++++++++++++++++------------------
 ui/template/header.html |  4 +++-
 2 files changed, 23 insertions(+), 19 deletions(-)

diff --git a/ui/config-overrides.js b/ui/config-overrides.js
index 19698173..9d1a3a7a 100644
--- a/ui/config-overrides.js
+++ b/ui/config-overrides.js
@@ -44,27 +44,11 @@ module.exports = {
       minChunks: 2,
       cacheGroups: {
         automaticNamePrefix: 'chunk',
-        components: {
-          test: /[\\/]components[\\/]/,
-          name: 'components',
-          priority: 13,
-          minChunks: 2,
-          reuseExistingChunk: true,
-          enforce: true,
-        },
-        commons: {
-          test: /[\\/]common[\\/]/,
-          name: 'common',
-          priority: 12,
-          minChunks: 2,
-          reuseExistingChunk: true,
-          enforce: true,
-        },
         i18next: {
           name: 'i18next',
           test: /[\/]node_modules[\/](i18next)[\/]/,
           filename: 'static/js/[name].[contenthash:8].chunk.js',
-          priority: 11,
+          priority: 12,
           reuseExistingChunk: true,
           minChunks: 1,
           chunks: 'initial',
@@ -73,11 +57,20 @@ module.exports = {
           name: 'react-bootstrap',
           test: /[\/]node_modules[\/](react-bootstrap)[\/]/,
           filename: 'static/js/[name].[contenthash:8].chunk.js',
-          priority: 10,
+          priority: 11,
           minChunks: 1,
           chunks: 'initial',
           reuseExistingChunk: true,
         },
+        lodash: {
+          name: 'lodash',
+          test: /[\/]node_modules[\/](lodash)[\/]/,
+          filename: 'static/js/[name].[contenthash:8].chunk.js',
+          priority: 10,
+          reuseExistingChunk: true,
+          minChunks: 1,
+          chunks: 'initial',
+        },
         codemirror: {
           name: 'codemirror',
           test: /[\/]node_modules[\/](codemirror)[\/]/,
@@ -103,6 +96,15 @@ module.exports = {
           minChunks: 1,
           chunks: 'initial',
         },
+        reactDom: {
+          name: 'react-dom',
+          test: /[\/]node_modules[\/](react-dom)[\/]/,
+          filename: 'static/js/[name].[contenthash:8].chunk.js',
+          priority: 7,
+          reuseExistingChunk: true,
+          chunks: 'all',
+          enforce: true,
+        },
         nodesAsync: {
           name: 'chunk-nodesAsync',
           test: /[\/]node_modules[\/]/,
diff --git a/ui/template/header.html b/ui/template/header.html
index 85425674..75c696f9 100644
--- a/ui/template/header.html
+++ b/ui/template/header.html
@@ -54,7 +54,9 @@
       href="{{.siteinfo.Branding.SquareIcon}}"
       data-rh="true"
     />
-    <script defer="defer" src="{{.scriptPath}}"></script>
+    {{range $path := .scriptPath}}
+    <script defer="defer" src="{{$path}}"></script>
+    {{end}}
     {{if $.siteinfo.JsonLD }}{{ .siteinfo.JsonLD | templateHTML}}{{end}}
   </head>
 

Reply via email to