@mantiq/vite 0.5.4 → 0.5.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
package/src/Vite.ts
CHANGED
|
@@ -474,6 +474,11 @@ export class Vite {
|
|
|
474
474
|
getConfig(): Readonly<ViteConfig> {
|
|
475
475
|
return this.config
|
|
476
476
|
}
|
|
477
|
+
|
|
478
|
+
/** Returns the application base path. */
|
|
479
|
+
getBasePath(): string {
|
|
480
|
+
return this.basePath
|
|
481
|
+
}
|
|
477
482
|
}
|
|
478
483
|
|
|
479
484
|
/** Escape HTML special characters to prevent XSS. */
|
|
@@ -23,7 +23,14 @@ export class ServeStaticFiles implements Middleware {
|
|
|
23
23
|
|
|
24
24
|
private getPublicDir(): string {
|
|
25
25
|
if (this.publicDir) return this.publicDir
|
|
26
|
-
if (this.vite)
|
|
26
|
+
if (this.vite) {
|
|
27
|
+
const publicDir = this.vite.getConfig().publicDir
|
|
28
|
+
const basePath = this.vite.getBasePath()
|
|
29
|
+
if (basePath && !publicDir.startsWith('/')) {
|
|
30
|
+
return `${basePath}/${publicDir}`
|
|
31
|
+
}
|
|
32
|
+
return publicDir
|
|
33
|
+
}
|
|
27
34
|
return 'public'
|
|
28
35
|
}
|
|
29
36
|
|