Skip to content

Build your personal knowledge base with Trilium Notes

fix(client/vite): handle static assets

Elian Dorane28a64a037d8
diff --git a/apps/client/package.json b/apps/client/package.json
index 773a27a051..c98f45bbc6 100644
--- a/apps/client/package.json
+++ b/apps/client/package.json
@@ -62,7 +62,8 @@
"@types/react-dom": "19.1.5",
"copy-webpack-plugin": "13.0.0",
"happy-dom": "17.4.7",
- "script-loader": "0.7.2"
+ "script-loader": "0.7.2",
+ "vite-plugin-static-copy": "3.0.0"
},
"nx": {
"name": "client"
diff --git a/apps/client/vite.config.ts b/apps/client/vite.config.ts
index dfc3e60831..83bc0a6fc7 100644
--- a/apps/client/vite.config.ts
+++ b/apps/client/vite.config.ts
@@ -1,6 +1,9 @@
/// <reference types='vitest' />
import { join } from 'path';
import { defineConfig } from 'vite';
+import { viteStaticCopy } from 'vite-plugin-static-copy'
+
+const assets = [ "assets", "stylesheets", "libraries", "fonts", "translations" ];
export default defineConfig(() => ({
root: __dirname,
@@ -13,7 +16,14 @@ export default defineConfig(() => ({
port: 4300,
host: 'localhost',
},
- plugins: [],
+ plugins: [
+ viteStaticCopy({
+ targets: assets.map((asset) => ({
+ src: `src/${asset}/**/*`,
+ dest: asset
+ }))
+ })
+ ],
// Uncomment this if you are using workers.
// worker: {
// plugins: [ nxViteTsPaths() ],
diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml
index 22b41930ce..0b000f9170 100644
--- a/pnpm-lock.yaml
+++ b/pnpm-lock.yaml
@@ -321,6 +321,9 @@ importers:
script-loader:
specifier: 0.7.2
version: 0.7.2
+ vite-plugin-static-copy:
+ specifier: 3.0.0
apps/db-compare:
dependencies:
@@ -13750,6 +13753,12 @@ packages:
vite:
optional: true
+ resolution: {integrity: sha512-Uki9pPUQ4ZnoMEdIFabvoh9h6Bh9Q1m3iF7BrZvoiF30reREpJh2gZb4jOnW1/uYFzyRiLCmFSkM+8hwiq1vWQ==}
+ engines: {node: ^18.0.0 || >=20.0.0}
+ peerDependencies:
+ vite: ^5.0.0 || ^6.0.0
+
resolution: {integrity: sha512-WaiOUlmt1fKw1w/WWJnx9gVk42D1BASKZmGCPpy6iTLE5iIemN2lim3MwI7Rffyt3aQnPrLfLSLnI8ZUJ9s49g==}
peerDependencies:
@@ -30072,6 +30081,15 @@ snapshots:
- rollup
- supports-color
+ dependencies:
+ chokidar: 3.6.0
+ fs-extra: 11.3.0
+ p-map: 7.0.3
+ picocolors: 1.1.1
+ tinyglobby: 0.2.13
+
dependencies:
svgo: 3.3.2