mirror of
				https://github.com/zadam/trilium.git
				synced 2025-11-04 05:28:59 +01:00 
			
		
		
		
	fix(dx/client): client not starting due to duplicate config
This commit is contained in:
		
							parent
							
								
									5cf182cf98
								
							
						
					
					
						commit
						35743de0df
					
				@ -7,12 +7,18 @@ import preact from "@preact/preset-vite";
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
const assets = [ "assets", "stylesheets", "fonts", "translations" ];
 | 
					const assets = [ "assets", "stylesheets", "fonts", "translations" ];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
export default defineConfig(() => ({
 | 
					const isDev = process.env.NODE_ENV === "development";
 | 
				
			||||||
    root: __dirname,
 | 
					let plugins: any = [
 | 
				
			||||||
    cacheDir: '../../node_modules/.vite/apps/client',
 | 
					    preact({
 | 
				
			||||||
    base: "",
 | 
					        babel: {
 | 
				
			||||||
    plugins: [
 | 
					            compact: !isDev
 | 
				
			||||||
        preact(),
 | 
					        }
 | 
				
			||||||
 | 
					    })
 | 
				
			||||||
 | 
					];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					if (!isDev) {
 | 
				
			||||||
 | 
					    plugins = [
 | 
				
			||||||
 | 
					        ...plugins,
 | 
				
			||||||
        viteStaticCopy({
 | 
					        viteStaticCopy({
 | 
				
			||||||
            targets: assets.map((asset) => ({
 | 
					            targets: assets.map((asset) => ({
 | 
				
			||||||
                src: `src/${asset}/*`,
 | 
					                src: `src/${asset}/*`,
 | 
				
			||||||
@ -29,7 +35,14 @@ export default defineConfig(() => ({
 | 
				
			|||||||
            ]
 | 
					            ]
 | 
				
			||||||
        }),
 | 
					        }),
 | 
				
			||||||
        webpackStatsPlugin()
 | 
					        webpackStatsPlugin()
 | 
				
			||||||
    ] as Plugin[],
 | 
					    ]
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					export default defineConfig(() => ({
 | 
				
			||||||
 | 
					    root: __dirname,
 | 
				
			||||||
 | 
					    cacheDir: '../../node_modules/.vite/apps/client',
 | 
				
			||||||
 | 
					    base: "",
 | 
				
			||||||
 | 
					    plugins,
 | 
				
			||||||
    resolve: {
 | 
					    resolve: {
 | 
				
			||||||
        alias: [
 | 
					        alias: [
 | 
				
			||||||
            {
 | 
					            {
 | 
				
			||||||
 | 
				
			|||||||
@ -27,17 +27,7 @@ async function register(app: express.Application) {
 | 
				
			|||||||
            appType: "custom",
 | 
					            appType: "custom",
 | 
				
			||||||
            cacheDir: path.join(srcRoot, "../../.cache/vite"),
 | 
					            cacheDir: path.join(srcRoot, "../../.cache/vite"),
 | 
				
			||||||
            base: `/${assetUrlFragment}/`,
 | 
					            base: `/${assetUrlFragment}/`,
 | 
				
			||||||
            root: path.join(srcRoot, "../client"),
 | 
					            root: path.join(srcRoot, "../client")
 | 
				
			||||||
            plugins: [
 | 
					 | 
				
			||||||
                preact({
 | 
					 | 
				
			||||||
                    babel: {
 | 
					 | 
				
			||||||
                        compact: false
 | 
					 | 
				
			||||||
                    }
 | 
					 | 
				
			||||||
                })
 | 
					 | 
				
			||||||
            ],
 | 
					 | 
				
			||||||
            define: {
 | 
					 | 
				
			||||||
                "process.env.IS_PREACT": JSON.stringify("true"),
 | 
					 | 
				
			||||||
            }
 | 
					 | 
				
			||||||
        });
 | 
					        });
 | 
				
			||||||
        app.use(`/${assetUrlFragment}/`, (req, res, next) => {
 | 
					        app.use(`/${assetUrlFragment}/`, (req, res, next) => {
 | 
				
			||||||
            req.url = `/${assetUrlFragment}` + req.url;
 | 
					            req.url = `/${assetUrlFragment}` + req.url;
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user