| 
									
										
										
										
											2025-04-22 17:13:17 +03:00
										 |  |  | const { NxAppWebpackPlugin } = require('@nx/webpack/app-plugin'); | 
					
						
							| 
									
										
										
										
											2025-04-24 11:18:08 +03:00
										 |  |  | const CopyPlugin = require('copy-webpack-plugin'); | 
					
						
							| 
									
										
										
										
											2025-04-24 13:18:06 +03:00
										 |  |  | const { join, default: path } = require('path'); | 
					
						
							| 
									
										
										
										
											2025-04-22 17:13:17 +03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-04-24 11:18:08 +03:00
										 |  |  | const outputDir = join(__dirname, 'dist'); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-04-24 13:18:06 +03:00
										 |  |  | function buildFilesToCopy() { | 
					
						
							| 
									
										
										
										
											2025-04-24 21:45:13 +03:00
										 |  |  |   const files = []; | 
					
						
							| 
									
										
										
										
											2025-04-24 13:18:06 +03:00
										 |  |  | 
 | 
					
						
							|  |  |  |   files.push({ | 
					
						
							|  |  |  |     from: "../client/dist", | 
					
						
							|  |  |  |     to: join(outputDir, "public") | 
					
						
							|  |  |  |   }); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   const nodePaths = [ | 
					
						
							|  |  |  |     "@excalidraw/excalidraw/dist/prod/fonts/", | 
					
						
							|  |  |  |     "katex/dist", | 
					
						
							|  |  |  |     "boxicons/css", | 
					
						
							|  |  |  |     "boxicons/fonts", | 
					
						
							|  |  |  |     "jquery/dist", | 
					
						
							|  |  |  |     "jquery-hotkeys", | 
					
						
							|  |  |  |     "autocomplete.js/dist", | 
					
						
							| 
									
										
										
										
											2025-04-26 10:14:01 +03:00
										 |  |  |     "normalize.css/normalize.css", | 
					
						
							| 
									
										
										
										
											2025-04-24 13:18:06 +03:00
										 |  |  |     "jquery.fancytree/dist", | 
					
						
							|  |  |  |     "codemirror/lib", | 
					
						
							|  |  |  |     "codemirror/addon", | 
					
						
							|  |  |  |     "codemirror/mode", | 
					
						
							|  |  |  |     "codemirror/keymap", | 
					
						
							| 
									
										
										
										
											2025-04-24 21:45:13 +03:00
										 |  |  |     "@highlightjs/cdn-assets", | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     // Required as they are native dependencies and cannot be well bundled.
 | 
					
						
							|  |  |  |     "better-sqlite3", | 
					
						
							|  |  |  |     "bindings", | 
					
						
							|  |  |  |     "file-uri-to-path" | 
					
						
							| 
									
										
										
										
											2025-04-24 13:18:06 +03:00
										 |  |  |   ]; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   for (const nodePath of nodePaths) { | 
					
						
							|  |  |  |     files.push({ | 
					
						
							| 
									
										
										
										
											2025-04-27 10:28:22 +03:00
										 |  |  |       from: join("..", "..", "node_modules", nodePath), | 
					
						
							| 
									
										
										
										
											2025-04-24 13:18:06 +03:00
										 |  |  |       to: join(outputDir, "node_modules", nodePath) | 
					
						
							|  |  |  |     }) | 
					
						
							|  |  |  |   } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   return files; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-04-22 17:13:17 +03:00
										 |  |  | module.exports = { | 
					
						
							|  |  |  |   output: { | 
					
						
							| 
									
										
										
										
											2025-04-24 11:18:08 +03:00
										 |  |  |     path: outputDir | 
					
						
							| 
									
										
										
										
											2025-04-22 17:13:17 +03:00
										 |  |  |   }, | 
					
						
							|  |  |  |   plugins: [ | 
					
						
							|  |  |  |     new NxAppWebpackPlugin({ | 
					
						
							|  |  |  |       target: 'node', | 
					
						
							|  |  |  |       compiler: 'tsc', | 
					
						
							|  |  |  |       main: './src/main.ts', | 
					
						
							|  |  |  |       tsConfig: './tsconfig.app.json', | 
					
						
							|  |  |  |       assets: ["./src/assets"], | 
					
						
							|  |  |  |       optimization: false, | 
					
						
							|  |  |  |       outputHashing: 'none', | 
					
						
							|  |  |  |       generatePackageJson: true, | 
					
						
							| 
									
										
										
										
											2025-04-25 00:14:00 +03:00
										 |  |  |       externalDependencies: [ | 
					
						
							|  |  |  |         "electron/main", | 
					
						
							|  |  |  |         "@electron/remote/main", | 
					
						
							|  |  |  |         "electron", | 
					
						
							|  |  |  |         "@electron/remote",         | 
					
						
							|  |  |  |         "better-sqlite3" | 
					
						
							|  |  |  |       ] | 
					
						
							| 
									
										
										
										
											2025-04-24 11:18:08 +03:00
										 |  |  |     }), | 
					
						
							|  |  |  |     new CopyPlugin({ | 
					
						
							| 
									
										
										
										
											2025-04-24 13:18:06 +03:00
										 |  |  |       patterns: buildFilesToCopy() | 
					
						
							| 
									
										
										
										
											2025-04-22 17:13:17 +03:00
										 |  |  |     }) | 
					
						
							| 
									
										
										
										
											2025-04-22 19:47:27 +03:00
										 |  |  |   ] | 
					
						
							| 
									
										
										
										
											2025-04-22 17:13:17 +03:00
										 |  |  | }; |