MOBILE-3876 build: Configure bundle minification
This commit is contained in:
		
							parent
							
								
									a89140df96
								
							
						
					
					
						commit
						3db470c0a4
					
				| @ -12,8 +12,11 @@ | ||||
|       "schematics": {}, | ||||
|       "architect": { | ||||
|         "build": { | ||||
|           "builder": "@angular-devkit/build-angular:browser", | ||||
|           "builder": "@angular-builders/custom-webpack:browser", | ||||
|           "options": { | ||||
|             "customWebpackConfig": { | ||||
|               "path": "./webpack.config.js" | ||||
|             }, | ||||
|             "allowedCommonJsDependencies":[ | ||||
|                 "chart.js" | ||||
|             ], | ||||
|  | ||||
							
								
								
									
										31437
									
								
								package-lock.json
									
									
									
										generated
									
									
									
								
							
							
						
						
									
										31437
									
								
								package-lock.json
									
									
									
										generated
									
									
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							| @ -128,6 +128,8 @@ | ||||
|     "zone.js": "~0.10.3" | ||||
|   }, | ||||
|   "devDependencies": { | ||||
|     "@angular-builders/custom-webpack": "^10.0.1", | ||||
|     "@angular-devkit/architect": "^0.1202.7", | ||||
|     "@angular-devkit/build-angular": "~0.1000.8", | ||||
|     "@angular-eslint/builder": "^4.2.0", | ||||
|     "@angular-eslint/eslint-plugin": "^4.2.0", | ||||
| @ -169,6 +171,7 @@ | ||||
|     "jest-preset-angular": "^8.3.1", | ||||
|     "jsonc-parser": "^2.3.1", | ||||
|     "native-run": "^1.4.0", | ||||
|     "terser-webpack-plugin": "^4.2.3", | ||||
|     "ts-jest": "^26.4.1", | ||||
|     "ts-node": "~8.3.0", | ||||
|     "typescript": "^3.9.9" | ||||
|  | ||||
							
								
								
									
										36
									
								
								webpack.config.js
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										36
									
								
								webpack.config.js
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,36 @@ | ||||
| // (C) Copyright 2015 Moodle Pty Ltd.
 | ||||
| //
 | ||||
| // Licensed under the Apache License, Version 2.0 (the "License");
 | ||||
| // you may not use this file except in compliance with the License.
 | ||||
| // You may obtain a copy of the License at
 | ||||
| //
 | ||||
| //     http://www.apache.org/licenses/LICENSE-2.0
 | ||||
| //
 | ||||
| // Unless required by applicable law or agreed to in writing, software
 | ||||
| // distributed under the License is distributed on an "AS IS" BASIS,
 | ||||
| // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 | ||||
| // See the License for the specific language governing permissions and
 | ||||
| // limitations under the License.
 | ||||
| 
 | ||||
| const TerserPlugin = require('terser-webpack-plugin'); | ||||
| 
 | ||||
| module.exports = config => { | ||||
|     config.optimization.minimizer.push( | ||||
|         new TerserPlugin({ | ||||
|             terserOptions: { | ||||
|                 mangle: { | ||||
|                     keep_classnames: true, | ||||
|                     keep_fnames: true, | ||||
|                 }, | ||||
|                 compress: { | ||||
|                     toplevel: true, | ||||
|                     pure_getters: true, | ||||
|                 }, | ||||
|                 keep_classnames: true, | ||||
|                 keep_fnames: true, | ||||
|             }, | ||||
|         }), | ||||
|     ); | ||||
| 
 | ||||
|     return config; | ||||
| }; | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user