mirror of
https://github.com/TriliumNext/Notes.git
synced 2025-07-29 11:02:28 +08:00
fix(vite): serving of source assets
This commit is contained in:
parent
e536ec4cbf
commit
40aa71b2b4
@ -55,9 +55,9 @@ export default defineConfig(() => ({
|
|||||||
runtime: join(__dirname, "src", "runtime.ts")
|
runtime: join(__dirname, "src", "runtime.ts")
|
||||||
},
|
},
|
||||||
output: {
|
output: {
|
||||||
entryFileNames: "[name].js",
|
entryFileNames: "src/[name].js",
|
||||||
chunkFileNames: "[name].js",
|
chunkFileNames: "src/[name].js",
|
||||||
assetFileNames: "[name,].js"
|
assetFileNames: "src/[name,].js"
|
||||||
},
|
},
|
||||||
onwarn(warning, rollupWarn) {
|
onwarn(warning, rollupWarn) {
|
||||||
if (warning.code === "MODULE_LEVEL_DIRECTIVE") {
|
if (warning.code === "MODULE_LEVEL_DIRECTIVE") {
|
||||||
|
@ -25,13 +25,11 @@ async function register(app: express.Application) {
|
|||||||
if (!publicUrl) {
|
if (!publicUrl) {
|
||||||
throw new Error("Missing TRILIUM_PUBLIC_SERVER");
|
throw new Error("Missing TRILIUM_PUBLIC_SERVER");
|
||||||
}
|
}
|
||||||
app.use(`/@fs`, proxy(publicUrl, {
|
app.use(assetPath + `/@fs`, proxy(publicUrl, {
|
||||||
proxyReqPathResolver: (req) => `/@fs` + req.url
|
proxyReqPathResolver: (req) => assetPath + `/@fs` + req.url
|
||||||
}))
|
}))
|
||||||
} else {
|
} else {
|
||||||
const clientStaticCache = persistentCacheStatic(path.join(resourceDir, "public"));
|
app.use(`/${assetPath}/src`, persistentCacheStatic(path.join(resourceDir, "public", "src")));
|
||||||
app.use(`/${assetPath}/app`, clientStaticCache);
|
|
||||||
app.use(`/${assetPath}/app-dist`, clientStaticCache);
|
|
||||||
app.use(`/${assetPath}/stylesheets`, persistentCacheStatic(path.join(resourceDir, "public", "stylesheets")));
|
app.use(`/${assetPath}/stylesheets`, persistentCacheStatic(path.join(resourceDir, "public", "stylesheets")));
|
||||||
app.use(`/${assetPath}/libraries`, persistentCacheStatic(path.join(resourceDir, "public", "libraries")));
|
app.use(`/${assetPath}/libraries`, persistentCacheStatic(path.join(resourceDir, "public", "libraries")));
|
||||||
app.use(`/${assetPath}/fonts`, persistentCacheStatic(path.join(resourceDir, "public", "fonts")));
|
app.use(`/${assetPath}/fonts`, persistentCacheStatic(path.join(resourceDir, "public", "fonts")));
|
||||||
|
Loading…
x
Reference in New Issue
Block a user