From af90533c8e7b89b0b2944d7806234085f81e99c9 Mon Sep 17 00:00:00 2001 From: onewe Date: Wed, 20 Apr 2022 10:20:26 +0800 Subject: [PATCH] [ISSUE #8156] Add hash-tag for js and css (#8157) * [ISSUE #8156] Add hash-tag for js and css - add index.html to copyList - use index.ejs instead of index.html - webpack enable hash Close #8156 * [ISSUE #8156] Fix context-path error in development environment Close #8156 --- console-ui/build/copyFile.js | 2 +- console-ui/build/webpack.base.conf.js | 6 +- console-ui/public/index.ejs | 61 ++++++++++++++++++++ console-ui/public/index.html | 58 ------------------- console/src/main/resources/static/index.html | 49 ++++++++-------- 5 files changed, 91 insertions(+), 85 deletions(-) create mode 100644 console-ui/public/index.ejs delete mode 100644 console-ui/public/index.html diff --git a/console-ui/build/copyFile.js b/console-ui/build/copyFile.js index c80d2b6efb5..f046df60770 100644 --- a/console-ui/build/copyFile.js +++ b/console-ui/build/copyFile.js @@ -27,7 +27,7 @@ const mkdir = dir => { } }; -const copyList = ['js/main.js', 'css/main.css']; +const copyList = ['js/main.js', 'css/main.css', 'index.html']; copyList.forEach(_fileName => { const srcFileName = path.join(srcDir, _fileName); diff --git a/console-ui/build/webpack.base.conf.js b/console-ui/build/webpack.base.conf.js index b097f8755e3..ffa8b0cd593 100644 --- a/console-ui/build/webpack.base.conf.js +++ b/console-ui/build/webpack.base.conf.js @@ -95,7 +95,11 @@ module.exports = { plugins: [ new HtmlWebpackPlugin({ filename: 'index.html', - template: './public/index.html', + template: './public/index.ejs', + templateParameters: { + contextPath: isDev ? './' : 'console-ui/public/' + }, + hash: true, minify: !isDev, }), new CopyWebpackPlugin([ diff --git a/console-ui/public/index.ejs b/console-ui/public/index.ejs new file mode 100644 index 00000000000..3874409c78a --- /dev/null +++ b/console-ui/public/index.ejs @@ -0,0 +1,61 @@ + + + + + + + + + + + + + + Nacos + + + + + + + + + + + + +
+
+
+ + + + + + + + + + + + + + + + + + diff --git a/console-ui/public/index.html b/console-ui/public/index.html deleted file mode 100644 index 191c758f33f..00000000000 --- a/console-ui/public/index.html +++ /dev/null @@ -1,58 +0,0 @@ - - - - - - - - - - - Nacos - - - - - - - - - - - - -
-
-
- - - - - - - - - - - - - - - - - - diff --git a/console/src/main/resources/static/index.html b/console/src/main/resources/static/index.html index 9b3ad868fb9..a55516b6796 100644 --- a/console/src/main/resources/static/index.html +++ b/console/src/main/resources/static/index.html @@ -22,20 +22,20 @@ + + + Nacos - - - - + + + - - - - - + + + + - - +
@@ -43,20 +43,19 @@
- - - - - - - - - - - - - + + + + + + + + + + + + - +