| 
									
										
										
										
											2021-03-09 23:14:52 -08:00
										 |  |  | require('dotenv').config(); | 
					
						
							|  |  |  | const CracoAntDesignPlugin = require('craco-antd'); | 
					
						
							| 
									
										
										
										
											2021-08-31 22:00:56 -07:00
										 |  |  | const path = require('path'); | 
					
						
							| 
									
										
										
										
											2022-02-17 03:28:06 +08:00
										 |  |  | const CopyWebpackPlugin = require('copy-webpack-plugin'); | 
					
						
							| 
									
										
										
										
											2021-03-09 23:14:52 -08:00
										 |  |  | 
 | 
					
						
							|  |  |  | const themeConfig = require(`./src/conf/theme/${process.env.REACT_APP_THEME_CONFIG}`); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-03-11 10:06:48 -08:00
										 |  |  | function addLessPrefixToKeys(styles) { | 
					
						
							|  |  |  |     const output = {}; | 
					
						
							|  |  |  |     Object.keys(styles).forEach((key) => { | 
					
						
							|  |  |  |         output[`@${key}`] = styles[key]; | 
					
						
							|  |  |  |     }); | 
					
						
							|  |  |  |     return output; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-03-09 23:14:52 -08:00
										 |  |  | module.exports = { | 
					
						
							| 
									
										
										
										
											2022-02-17 03:28:06 +08:00
										 |  |  |     webpack: { | 
					
						
							|  |  |  |         plugins: { | 
					
						
							|  |  |  |             add: [ | 
					
						
							|  |  |  |                 // Self host images by copying them to the build directory
 | 
					
						
							|  |  |  |                 new CopyWebpackPlugin({ | 
					
						
							|  |  |  |                     patterns: [{ from: 'src/images', to: 'platforms' }], | 
					
						
							|  |  |  |                 }), | 
					
						
							| 
									
										
										
										
											2022-06-21 15:58:01 +02:00
										 |  |  |                 // Copy monaco-editor files to the build directory
 | 
					
						
							|  |  |  |                 new CopyWebpackPlugin({ | 
					
						
							|  |  |  |                     patterns: [ | 
					
						
							|  |  |  |                         { from: "node_modules/monaco-editor/min/vs/", to: "monaco-editor/vs" }, | 
					
						
							|  |  |  |                         { from: "node_modules/monaco-editor/min-maps/vs/", to: "monaco-editor/min-maps/vs" }, | 
					
						
							|  |  |  |                     ], | 
					
						
							|  |  |  |                 }), | 
					
						
							| 
									
										
										
										
											2022-02-17 03:28:06 +08:00
										 |  |  |             ], | 
					
						
							|  |  |  |         }, | 
					
						
							|  |  |  |     }, | 
					
						
							| 
									
										
										
										
											2021-03-09 23:14:52 -08:00
										 |  |  |     plugins: [ | 
					
						
							|  |  |  |         { | 
					
						
							|  |  |  |             plugin: CracoAntDesignPlugin, | 
					
						
							|  |  |  |             options: { | 
					
						
							| 
									
										
										
										
											2021-08-31 22:00:56 -07:00
										 |  |  |                 customizeThemeLessPath: path.join(__dirname, 'src/conf/theme/global-variables.less'), | 
					
						
							| 
									
										
										
										
											2021-03-11 10:06:48 -08:00
										 |  |  |                 customizeTheme: addLessPrefixToKeys(themeConfig.styles), | 
					
						
							| 
									
										
										
										
											2021-03-09 23:14:52 -08:00
										 |  |  |             }, | 
					
						
							|  |  |  |         }, | 
					
						
							|  |  |  |     ], | 
					
						
							| 
									
										
										
										
											2023-01-18 07:00:39 +08:00
										 |  |  |     jest: { | 
					
						
							|  |  |  |         configure: (jestConfig) => { | 
					
						
							|  |  |  |             jestConfig.transformIgnorePatterns = [ | 
					
						
							|  |  |  |                 // Ensures that lib0 and y-protocol libraries are transformed through babel as well
 | 
					
						
							|  |  |  |                 'node_modules/(?!(lib0|y-protocols)).+\\.(js|jsx|mjs|cjs|ts|tsx)$', | 
					
						
							|  |  |  |                 '^.+\\.module\\.(css|sass|scss)$', | 
					
						
							|  |  |  |             ]; | 
					
						
							|  |  |  |             return jestConfig; | 
					
						
							|  |  |  |         }, | 
					
						
							|  |  |  |     }, | 
					
						
							| 
									
										
										
										
											2021-03-09 23:14:52 -08:00
										 |  |  | }; |