-
-
Notifications
You must be signed in to change notification settings - Fork 3.3k
Closed
Labels
- P4: importantViolate documented behavior or significantly impacts performance (priority)Violate documented behavior or significantly impacts performance (priority)
Description
Astro Info
Astro v3.5.0
Node v20.2.0
System macOS (x64)
Package Manager pnpm
Output static
Adapter none
Integrations middleware-test
If this issue only occurs in one browser, which browser is a problem?
No response
Describe the Bug
Running a basic project with the following config:
// astro.config.mjs
export default defineConfig({
integrations: [
{
name: "middleware-test",
hooks: {
"astro:config:setup": ({ addMiddleware }) => {
addMiddleware({
order: "pre",
entrypoint: "./middleware.js",
});
},
},
},
],
});// middleware.js
export const onRequest = async (_, next) => {
console.log("middleware running...");
return await next();
};leads to an error:
[vite] Error when evaluating SSR module @astro-middleware: failed to import "undefined"
|- Error: Cannot find module 'undefined' imported from '@astro-middleware'
at nodeImport (file:///Users/root/code/astro-integration-middleware/node_modules/.pnpm/vite@4.5.0/node_modules/vite/dist/node/chunks/dep-bb8a8339.js:56088:25)
at ssrImport (file:///Users/root/code/astro-integration-middleware/node_modules/.pnpm/vite@4.5.0/node_modules/vite/dist/node/chunks/dep-bb8a8339.js:55990:30)
at eval (@astro-middleware:3:50)
at instantiateModule (file:///Users/root/code/astro-integration-middleware/node_modules/.pnpm/vite@4.5.0/node_modules/vite/dist/node/chunks/dep-bb8a8339.js:56052:15)
Failed to load url undefined (resolved id: undefined) in @astro-middleware. Does the file exist?
What's the expected result?
No errors
Link to Minimal Reproducible Example
https://github.com/pilcrowOnPaper/astro-integration-middleware
Participation
- I am willing to submit a pull request for this issue.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
- P4: importantViolate documented behavior or significantly impacts performance (priority)Violate documented behavior or significantly impacts performance (priority)