-
Notifications
You must be signed in to change notification settings - Fork 17
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Not working with nested plugin app #23
Comments
I can confirm the same thing. Wrapping the static plugin in a separate Elysia app, like this: export const serveStaticFiles = new Elysia({ name: '~/lib/serveStatic' }).use(
staticPlugin(
NODE_ENV === 'development'
? {
headers: {
'Cache-Control':
'no-store, no-cache, must-revalidate, proxy-revalidate',
Expires: '0',
'Surrogate-Control': 'no-store',
Pragma: 'no-cache',
},
}
: {},
),
); raises the following TypeScript error:
|
Hi, @houssemFat did you find any workaround? EDIT:
|
Thanks for reporting these findings! You've to import { Elysia } from "elysia";
import { staticPlugin } from "@elysiajs/static";
export const SSRPlugin = async () => {
return new Elysia({ name: "vite" }).use(await staticPlugin({}));
}; @adicco I can't reproduce this type error, can you try the latest versions? |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi , thank you for all the effort behind elysia and elysia-static.
Description
I'm trying to use a SSR plugin and i need the
elysia-static
plugin only on production. So i will check if i'm in prod or dev mode and i will use a custom plugin that will includeelysia-static
in the Elysia app (nested app for plugin). When we use the plugin in the main Elysia instance (the instance that acts as server) , the plugin works fine , but when we use it with a nested Elysia app (a plugin Elysia app), the plugin don't work as expected (I get 404).Below my folder structure.
Usage with the main Elysia instance : OK
Works fine when using the plugin with main Elysia instance. The
http://localhost:2000/assets/index-BRPLnx8F.js
url returns the file.main.js
Usage with Nested plugin : NOK
the
http://localhost:2000/assets/index-BRPLnx8F.js
returnsNOT_FOUND
SSRPlugin.js
main.js
Info
The text was updated successfully, but these errors were encountered: