| 
									
										
										
										
											2019-11-18 21:53:16 +08:00
										 |  |  | const svgToMiniDataURI = require("mini-svg-data-uri"); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-11-16 00:27:36 +08:00
										 |  |  | module.exports = { | 
					
						
							|  |  |  | 	output: { | 
					
						
							|  |  |  | 		assetModuleFilename: "images/[hash][ext]" | 
					
						
							|  |  |  | 	}, | 
					
						
							|  |  |  | 	module: { | 
					
						
							|  |  |  | 		rules: [ | 
					
						
							|  |  |  | 			{ | 
					
						
							| 
									
										
										
										
											2019-11-18 22:04:49 +08:00
										 |  |  | 				test: /\.(png|jpg)$/, | 
					
						
							|  |  |  | 				type: "asset" | 
					
						
							|  |  |  | 			}, | 
					
						
							|  |  |  | 			{ | 
					
						
							|  |  |  | 				test: /\.svg$/, | 
					
						
							| 
									
										
										
										
											2019-11-16 00:27:36 +08:00
										 |  |  | 				type: "asset", | 
					
						
							|  |  |  | 				generator: { | 
					
						
							|  |  |  | 					dataUrl: content => { | 
					
						
							| 
									
										
										
										
											2019-11-18 00:49:48 +08:00
										 |  |  | 						if (typeof content !== "string") { | 
					
						
							|  |  |  | 							content = content.toString(); | 
					
						
							|  |  |  | 						} | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-11-18 21:53:16 +08:00
										 |  |  | 						return svgToMiniDataURI(content); | 
					
						
							| 
									
										
										
										
											2019-11-16 00:27:36 +08:00
										 |  |  | 					} | 
					
						
							|  |  |  | 				} | 
					
						
							|  |  |  | 			} | 
					
						
							|  |  |  | 		] | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | }; |