mirror of
				https://github.com/TriliumNext/Notes.git
				synced 2025-10-31 21:11:30 +08:00 
			
		
		
		
	fix(vite): use base path
This commit is contained in:
		
							parent
							
								
									6286c39381
								
							
						
					
					
						commit
						e536ec4cbf
					
				| @ -2,12 +2,14 @@ | |||||||
| import { join } from 'path'; | import { join } from 'path'; | ||||||
| import { defineConfig } from 'vite'; | import { defineConfig } from 'vite'; | ||||||
| import { viteStaticCopy } from 'vite-plugin-static-copy' | import { viteStaticCopy } from 'vite-plugin-static-copy' | ||||||
|  | import asset_path from './src/asset_path'; | ||||||
| 
 | 
 | ||||||
| const assets = [ "assets", "stylesheets", "libraries", "fonts", "translations" ]; | const assets = [ "assets", "stylesheets", "libraries", "fonts", "translations" ]; | ||||||
| 
 | 
 | ||||||
| export default defineConfig(() => ({ | export default defineConfig(() => ({ | ||||||
|     root: __dirname, |     root: __dirname, | ||||||
|     cacheDir: '../../node_modules/.vite/apps/client', |     cacheDir: '../../node_modules/.vite/apps/client', | ||||||
|  |     base: "/" + asset_path, | ||||||
|     server: { |     server: { | ||||||
|         port: 4200, |         port: 4200, | ||||||
|         host: 'localhost', |         host: 'localhost', | ||||||
|  | |||||||
| @ -1,4 +1,3 @@ | |||||||
| import assetPath from "./asset_path.js"; | import assetPath from "./asset_path.js"; | ||||||
| import { isDev } from "./utils.js"; |  | ||||||
| 
 | 
 | ||||||
| export default isDev ? assetPath + "/src" : assetPath + "/app-dist"; | export default assetPath + "/src"; | ||||||
|  | |||||||
| @ -1,6 +1,6 @@ | |||||||
| import packageJson from "../../package.json" with { type: "json" }; | import packageJson from "../../package.json" with { type: "json" }; | ||||||
| import { isDev } from "./utils"; | import { isDev } from "./utils"; | ||||||
| 
 | 
 | ||||||
| const assetPath = isDev ? `http://localhost:4200` : `assets/v${packageJson.version}`; | const assetPath = isDev ? `http://localhost:4200/assets/v${packageJson.version}` : `assets/v${packageJson.version}`; | ||||||
| 
 | 
 | ||||||
| export default assetPath; | export default assetPath; | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user
	 Elian Doran
						Elian Doran