Hey,
I am trying to use MongoDB using the new Fresh 2.0 and Vite. However, as soon as I call new MongoClient(uri) it fails, throwing [vite] (ssr) Error when evaluating SSR module fresh:server_entry: (0 , resource_management_1.configureResourceManagement) is not a function.
It doesn't matter if I call it from a middleware, component, or everywhere else; the error persists.
Let me know if you need more context!
My dependencies:
"imports": {
"fresh": "jsr:@fresh/core@^2.0.0-beta.4",
"preact": "npm:preact@^10.27.1",
"@preact/signals": "npm:@preact/signals@^2.3.1",
"@fresh/plugin-vite": "jsr:@fresh/plugin-vite@^0.9.13",
"vite": "npm:vite@^7.1.3",
"tailwindcss": "npm:tailwindcss@^4.1.10",
"@tailwindcss/vite": "npm:@tailwindcss/vite@^4.1.12",
"@deno/gfm": "jsr:@deno/gfm@^0.11.0",
"@valibot/valibot": "jsr:@valibot/valibot@^1.1.0",
"$std/": "https://deno.land/std@0.216.0/",
"mongodb": "npm:mongodb@6.19.0",
"bcrypt": "https://deno.land/x/bcrypt@v0.4.1/mod.ts"
},
How to reproduce:
- add
npm:mongodb
- call
new MongoClient() in the project
Example
...
// Pass a shared value from a middleware
app.use(async (ctx) => {
ctx.state.shared = "hello";
const client = new MongoClient("mongodb://127.0.0.1:27017");
return await ctx.next();
});
...
Hey,
I am trying to use MongoDB using the new Fresh 2.0 and Vite. However, as soon as I call
new MongoClient(uri)it fails, throwing[vite] (ssr) Error when evaluating SSR module fresh:server_entry: (0 , resource_management_1.configureResourceManagement) is not a function.It doesn't matter if I call it from a middleware, component, or everywhere else; the error persists.
Let me know if you need more context!
My dependencies:
How to reproduce:
npm:mongodbnew MongoClient()in the projectExample