| 
									
										
										
										
											2019-11-29 19:59:39 +08:00
										 |  |  | const path = require("path"); | 
					
						
							|  |  |  | const MiniCSSExtractPlugin = require("mini-css-extract-plugin"); | 
					
						
							| 
									
										
										
										
											2022-07-11 23:50:09 +08:00
										 |  |  | const CssMinimizerPlugin = require("css-minimizer-webpack-plugin"); | 
					
						
							|  |  |  | const RemoveEmptyScriptsPlugin = require("webpack-remove-empty-scripts"); | 
					
						
							| 
									
										
										
										
											2020-01-13 20:28:09 +08:00
										 |  |  | const { CleanWebpackPlugin: CleanPlugin } = require("clean-webpack-plugin"); | 
					
						
							| 
									
										
										
										
											2019-11-29 19:59:39 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-05-28 03:36:12 +08:00
										 |  |  | module.exports = (env, argv) => ({ | 
					
						
							| 
									
										
										
										
											2019-12-05 17:34:13 +08:00
										 |  |  |   mode: "development", | 
					
						
							| 
									
										
										
										
											2019-11-29 19:59:39 +08:00
										 |  |  |   entry: { | 
					
						
							| 
									
										
										
										
											2019-11-30 01:01:19 +08:00
										 |  |  |     pluginSetupWizard: [ | 
					
						
							| 
									
										
										
										
											2019-12-05 17:34:13 +08:00
										 |  |  |       path.join(__dirname, "src/main/js/pluginSetupWizard.js"), | 
					
						
							| 
									
										
										
										
											2023-05-15 04:40:34 +08:00
										 |  |  |       path.join(__dirname, "src/main/scss/pluginSetupWizard.scss"), | 
					
						
							| 
									
										
										
										
											2020-12-08 15:29:21 +08:00
										 |  |  |     ], | 
					
						
							|  |  |  |     "plugin-manager-ui": [ | 
					
						
							|  |  |  |       path.join(__dirname, "src/main/js/plugin-manager-ui.js"), | 
					
						
							| 
									
										
										
										
											2019-11-30 01:01:19 +08:00
										 |  |  |     ], | 
					
						
							| 
									
										
										
										
											2019-11-29 19:59:39 +08:00
										 |  |  |     "add-item": [ | 
					
						
							|  |  |  |       path.join(__dirname, "src/main/js/add-item.js"), | 
					
						
							| 
									
										
										
										
											2023-04-21 15:34:41 +08:00
										 |  |  |       path.join(__dirname, "src/main/js/add-item.scss"), | 
					
						
							| 
									
										
										
										
											2019-11-29 19:59:39 +08:00
										 |  |  |     ], | 
					
						
							| 
									
										
										
										
											2024-03-18 22:59:05 +08:00
										 |  |  |     "pages/computer-set": [ | 
					
						
							|  |  |  |       path.join(__dirname, "src/main/js/pages/computer-set"), | 
					
						
							|  |  |  |     ], | 
					
						
							| 
									
										
										
										
											2023-03-17 21:25:07 +08:00
										 |  |  |     "pages/dashboard": [path.join(__dirname, "src/main/js/pages/dashboard")], | 
					
						
							| 
									
										
										
										
											2023-01-01 00:52:25 +08:00
										 |  |  |     "pages/manage-jenkins/system-information": [ | 
					
						
							|  |  |  |       path.join( | 
					
						
							|  |  |  |         __dirname, | 
					
						
							| 
									
										
										
										
											2023-07-27 15:28:43 +08:00
										 |  |  |         "src/main/js/pages/manage-jenkins/system-information", | 
					
						
							| 
									
										
										
										
											2023-01-01 00:52:25 +08:00
										 |  |  |       ), | 
					
						
							|  |  |  |     ], | 
					
						
							| 
									
										
										
										
											2022-10-20 02:18:31 +08:00
										 |  |  |     app: [path.join(__dirname, "src/main/js/app.js")], | 
					
						
							| 
									
										
										
										
											2025-04-18 12:24:10 +08:00
										 |  |  |     header: [path.join(__dirname, "src/main/js/components/header/index.js")], | 
					
						
							| 
									
										
										
										
											2023-10-12 06:47:48 +08:00
										 |  |  |     "pages/cloud-set": [ | 
					
						
							|  |  |  |       path.join(__dirname, "src/main/js/pages/cloud-set/index.js"), | 
					
						
							|  |  |  |       path.join(__dirname, "src/main/js/pages/cloud-set/index.scss"), | 
					
						
							|  |  |  |     ], | 
					
						
							| 
									
										
										
										
											2022-12-16 22:06:17 +08:00
										 |  |  |     "pages/manage-jenkins": [ | 
					
						
							|  |  |  |       path.join(__dirname, "src/main/js/pages/manage-jenkins"), | 
					
						
							|  |  |  |     ], | 
					
						
							| 
									
										
										
										
											2023-05-06 21:13:56 +08:00
										 |  |  |     "pages/register": [path.join(__dirname, "src/main/js/pages/register")], | 
					
						
							| 
									
										
										
										
											2022-07-24 22:54:41 +08:00
										 |  |  |     "keyboard-shortcuts": [ | 
					
						
							|  |  |  |       path.join(__dirname, "src/main/js/keyboard-shortcuts.js"), | 
					
						
							|  |  |  |     ], | 
					
						
							| 
									
										
										
										
											2021-01-23 02:57:10 +08:00
										 |  |  |     "sortable-drag-drop": [ | 
					
						
							|  |  |  |       path.join(__dirname, "src/main/js/sortable-drag-drop.js"), | 
					
						
							|  |  |  |     ], | 
					
						
							| 
									
										
										
										
											2022-07-07 19:32:55 +08:00
										 |  |  |     "section-to-sidebar-items": [ | 
					
						
							|  |  |  |       path.join(__dirname, "src/main/js/section-to-sidebar-items.js"), | 
					
						
							|  |  |  |     ], | 
					
						
							| 
									
										
										
										
											2021-12-29 23:59:50 +08:00
										 |  |  |     "section-to-tabs": [path.join(__dirname, "src/main/js/section-to-tabs.js")], | 
					
						
							| 
									
										
										
										
											2022-07-18 19:40:27 +08:00
										 |  |  |     "components/row-selection-controller": [ | 
					
						
							|  |  |  |       path.join(__dirname, "src/main/js/components/row-selection-controller"), | 
					
						
							|  |  |  |     ], | 
					
						
							| 
									
										
										
										
											2024-06-14 21:21:23 +08:00
										 |  |  |     "pages/project/builds-card": [ | 
					
						
							|  |  |  |       path.join(__dirname, "src/main/js/pages/project/builds-card.js"), | 
					
						
							| 
									
										
										
										
											2021-09-28 03:27:37 +08:00
										 |  |  |     ], | 
					
						
							| 
									
										
										
										
											2023-04-21 15:34:41 +08:00
										 |  |  |     "simple-page": [path.join(__dirname, "src/main/scss/simple-page.scss")], | 
					
						
							|  |  |  |     styles: [path.join(__dirname, "src/main/scss/styles.scss")], | 
					
						
							| 
									
										
										
										
											2019-11-29 19:59:39 +08:00
										 |  |  |   }, | 
					
						
							|  |  |  |   output: { | 
					
						
							| 
									
										
										
										
											2024-10-13 02:46:18 +08:00
										 |  |  |     path: path.join(__dirname, "war/src/main/webapp/jsbundles"), | 
					
						
							| 
									
										
										
										
											2019-11-29 19:59:39 +08:00
										 |  |  |   }, | 
					
						
							| 
									
										
										
										
											2020-05-28 03:36:12 +08:00
										 |  |  |   devtool: | 
					
						
							|  |  |  |     argv.mode === "production" | 
					
						
							|  |  |  |       ? "source-map" | 
					
						
							|  |  |  |       : "inline-cheap-module-source-map", | 
					
						
							| 
									
										
										
										
											2019-11-29 19:59:39 +08:00
										 |  |  |   plugins: [ | 
					
						
							| 
									
										
										
										
											2022-07-11 23:50:09 +08:00
										 |  |  |     new RemoveEmptyScriptsPlugin({}), | 
					
						
							| 
									
										
										
										
											2019-11-29 19:59:39 +08:00
										 |  |  |     new MiniCSSExtractPlugin({ | 
					
						
							|  |  |  |       filename: "[name].css", | 
					
						
							|  |  |  |     }), | 
					
						
							| 
									
										
										
										
											2020-01-13 20:28:09 +08:00
										 |  |  |     // Clean all assets within the specified output.
 | 
					
						
							|  |  |  |     // It will not clean copied fonts
 | 
					
						
							|  |  |  |     new CleanPlugin(), | 
					
						
							| 
									
										
										
										
											2019-11-29 19:59:39 +08:00
										 |  |  |   ], | 
					
						
							|  |  |  |   module: { | 
					
						
							|  |  |  |     rules: [ | 
					
						
							| 
									
										
										
										
											2023-04-21 15:34:41 +08:00
										 |  |  |       { | 
					
						
							|  |  |  |         test: /\.(css|scss)$/, | 
					
						
							| 
									
										
										
										
											2020-05-28 23:34:41 +08:00
										 |  |  |         use: [ | 
					
						
							|  |  |  |           "style-loader", | 
					
						
							| 
									
										
										
										
											2020-05-28 03:36:12 +08:00
										 |  |  |           { | 
					
						
							|  |  |  |             loader: MiniCSSExtractPlugin.loader, | 
					
						
							|  |  |  |             options: { | 
					
						
							| 
									
										
										
										
											2022-07-09 01:36:12 +08:00
										 |  |  |               esModule: false, | 
					
						
							| 
									
										
										
										
											2020-05-28 03:36:12 +08:00
										 |  |  |             }, | 
					
						
							|  |  |  |           }, | 
					
						
							| 
									
										
										
										
											2020-02-21 00:57:47 +08:00
										 |  |  |           { | 
					
						
							|  |  |  |             loader: "css-loader", | 
					
						
							|  |  |  |             options: { | 
					
						
							| 
									
										
										
										
											2020-05-28 03:36:12 +08:00
										 |  |  |               sourceMap: true, | 
					
						
							| 
									
										
										
										
											2022-07-12 22:45:41 +08:00
										 |  |  |               // ignore the URLS on the base styles as they are picked
 | 
					
						
							| 
									
										
										
										
											2024-10-13 02:46:18 +08:00
										 |  |  |               // from the war/src/main/webapp/images dir
 | 
					
						
							| 
									
										
										
										
											2022-07-12 22:45:41 +08:00
										 |  |  |               url: { | 
					
						
							|  |  |  |                 filter: (url, resourcePath) => { | 
					
						
							| 
									
										
										
										
											2023-04-21 15:34:41 +08:00
										 |  |  |                   return !resourcePath.includes("styles.scss"); | 
					
						
							| 
									
										
										
										
											2020-02-21 00:57:47 +08:00
										 |  |  |                 }, | 
					
						
							|  |  |  |               }, | 
					
						
							|  |  |  |             }, | 
					
						
							|  |  |  |           }, | 
					
						
							| 
									
										
										
										
											2020-05-28 03:36:12 +08:00
										 |  |  |           { | 
					
						
							|  |  |  |             loader: "postcss-loader", | 
					
						
							|  |  |  |             options: { | 
					
						
							|  |  |  |               sourceMap: true, | 
					
						
							|  |  |  |             }, | 
					
						
							|  |  |  |           }, | 
					
						
							|  |  |  |           { | 
					
						
							| 
									
										
										
										
											2023-04-21 15:34:41 +08:00
										 |  |  |             loader: "sass-loader", | 
					
						
							| 
									
										
										
										
											2020-05-28 03:36:12 +08:00
										 |  |  |             options: { | 
					
						
							|  |  |  |               sourceMap: true, | 
					
						
							|  |  |  |             }, | 
					
						
							|  |  |  |           }, | 
					
						
							| 
									
										
										
										
											2020-02-21 00:57:47 +08:00
										 |  |  |         ], | 
					
						
							| 
									
										
										
										
											2019-11-29 19:59:39 +08:00
										 |  |  |       }, | 
					
						
							| 
									
										
										
										
											2019-11-30 01:01:19 +08:00
										 |  |  |       { | 
					
						
							|  |  |  |         test: /\.(woff(2)?|ttf|eot|svg)(\?v=\d+\.\d+\.\d+)?$/, | 
					
						
							| 
									
										
										
										
											2022-07-11 23:50:09 +08:00
										 |  |  |         type: "asset/resource", | 
					
						
							|  |  |  |         generator: { | 
					
						
							|  |  |  |           filename: "fonts/[name].[ext]", | 
					
						
							|  |  |  |         }, | 
					
						
							| 
									
										
										
										
											2019-11-30 01:01:19 +08:00
										 |  |  |       }, | 
					
						
							| 
									
										
										
										
											2019-12-05 17:34:13 +08:00
										 |  |  |       { | 
					
						
							|  |  |  |         test: /\.hbs$/, | 
					
						
							|  |  |  |         loader: "handlebars-loader", | 
					
						
							|  |  |  |         options: { | 
					
						
							| 
									
										
										
										
											2020-01-10 20:11:44 +08:00
										 |  |  |           // The preferred option for adding handlebars helpers is putting them
 | 
					
						
							|  |  |  |           // inside this helpers directory
 | 
					
						
							| 
									
										
										
										
											2019-12-05 17:34:13 +08:00
										 |  |  |           helperDirs: path.join(__dirname, "src/main/js/handlebars-helpers"), | 
					
						
							|  |  |  |           precompileOptions: { | 
					
						
							|  |  |  |             knownHelpersOnly: false, | 
					
						
							|  |  |  |             // Helpers registered with Handlebars.registerHelper must be listed so that
 | 
					
						
							| 
									
										
										
										
											2020-01-10 20:11:44 +08:00
										 |  |  |             // handlebars-loader will expect them when compiling the templates.
 | 
					
						
							|  |  |  |             // This helpers cannot be moved to the helpers directory because they are closures
 | 
					
						
							| 
									
										
										
										
											2019-12-05 17:34:13 +08:00
										 |  |  |             knownHelpers: [ | 
					
						
							|  |  |  |               "pluginCountForCategory", | 
					
						
							|  |  |  |               "totalPluginCount", | 
					
						
							|  |  |  |               "inSelectedPlugins", | 
					
						
							|  |  |  |               "dependencyCount", | 
					
						
							|  |  |  |               "eachDependency", | 
					
						
							|  |  |  |               "ifVisibleDependency", | 
					
						
							|  |  |  |             ], | 
					
						
							|  |  |  |           }, | 
					
						
							|  |  |  |         }, | 
					
						
							|  |  |  |       }, | 
					
						
							|  |  |  |       { | 
					
						
							|  |  |  |         test: /\.js$/, | 
					
						
							|  |  |  |         exclude: /node_modules/, | 
					
						
							|  |  |  |         loader: "babel-loader", | 
					
						
							|  |  |  |       }, | 
					
						
							| 
									
										
										
										
											2019-11-29 19:59:39 +08:00
										 |  |  |     ], | 
					
						
							|  |  |  |   }, | 
					
						
							|  |  |  |   optimization: { | 
					
						
							| 
									
										
										
										
											2019-11-30 01:01:19 +08:00
										 |  |  |     splitChunks: { | 
					
						
							| 
									
										
										
										
											2019-12-09 23:18:22 +08:00
										 |  |  |       chunks: "async", | 
					
						
							|  |  |  |       cacheGroups: { | 
					
						
							|  |  |  |         commons: { | 
					
						
							|  |  |  |           test: /[\\/]node_modules[\\/]/, | 
					
						
							|  |  |  |           name: "vendors", | 
					
						
							|  |  |  |           chunks: "all", | 
					
						
							|  |  |  |         }, | 
					
						
							|  |  |  |       }, | 
					
						
							| 
									
										
										
										
											2022-06-23 06:15:57 +08:00
										 |  |  |     }, | 
					
						
							|  |  |  |     minimizer: [ | 
					
						
							| 
									
										
										
										
											2022-06-25 23:56:16 +08:00
										 |  |  |       new CssMinimizerPlugin({ | 
					
						
							|  |  |  |         minimizerOptions: { | 
					
						
							|  |  |  |           preset: [ | 
					
						
							|  |  |  |             "default", | 
					
						
							|  |  |  |             { | 
					
						
							|  |  |  |               svgo: { exclude: true }, | 
					
						
							|  |  |  |             }, | 
					
						
							|  |  |  |           ], | 
					
						
							|  |  |  |         }, | 
					
						
							|  |  |  |       }), | 
					
						
							| 
									
										
										
										
											2022-06-23 06:15:57 +08:00
										 |  |  |     ], | 
					
						
							| 
									
										
										
										
											2019-12-05 17:34:13 +08:00
										 |  |  |   }, | 
					
						
							|  |  |  |   resolve: { | 
					
						
							|  |  |  |     alias: { | 
					
						
							| 
									
										
										
										
											2022-10-20 02:18:31 +08:00
										 |  |  |       "@": path.resolve(__dirname, "src/main/js"), | 
					
						
							| 
									
										
										
										
											2019-12-05 17:34:13 +08:00
										 |  |  |       // Needed to be able to register helpers at runtime
 | 
					
						
							|  |  |  |       handlebars: "handlebars/runtime", | 
					
						
							|  |  |  |     }, | 
					
						
							|  |  |  |   }, | 
					
						
							| 
									
										
										
										
											2020-05-28 03:36:12 +08:00
										 |  |  | }); |