mirror of
				https://github.com/zadam/trilium.git
				synced 2025-11-03 21:19:01 +01:00 
			
		
		
		
	fix(server): proxying of inner client modules
This commit is contained in:
		
							parent
							
								
									e28a64a037
								
							
						
					
					
						commit
						d4dbe1cb89
					
				@ -7,6 +7,7 @@ const assets = [ "assets", "stylesheets", "libraries", "fonts", "translations" ]
 | 
			
		||||
 | 
			
		||||
export default defineConfig(() => ({
 | 
			
		||||
    root: __dirname,
 | 
			
		||||
    base: "/assets/v0.94.0/app/",
 | 
			
		||||
    cacheDir: '../../node_modules/.vite/apps/client',
 | 
			
		||||
    server: {
 | 
			
		||||
        port: 4200,
 | 
			
		||||
 | 
			
		||||
@ -29,7 +29,16 @@ async function register(app: express.Application) {
 | 
			
		||||
            throw new Error("Missing TRILIUM_PUBLIC_SERVER");
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        const clientProxy = proxy(publicUrl);
 | 
			
		||||
        const clientProxy = proxy(publicUrl, {
 | 
			
		||||
            proxyReqPathResolver: (req) => {
 | 
			
		||||
                let url = req.url;
 | 
			
		||||
                url = url.replace(/^\/src/, "/");
 | 
			
		||||
                url = "/assets/v0.94.0/app/src" + url;
 | 
			
		||||
                url = url.replace(/.js$/, ".ts");
 | 
			
		||||
                console.log(`${req.url} => ${publicUrl}${url}`);
 | 
			
		||||
                return url;
 | 
			
		||||
            }
 | 
			
		||||
        });
 | 
			
		||||
        app.use(`/${assetPath}/app/doc_notes`, persistentCacheStatic(path.join(srcRoot, "assets", "doc_notes")));
 | 
			
		||||
        app.use(`/${assetPath}/app`, clientProxy);
 | 
			
		||||
        app.use(`/${assetPath}/app-dist`, clientProxy);
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user