Hi,
Thanks for the quick reply!
The middleware.ts file is currently situated in the /src directory which is what Astro's middleware uses.
I've attempted to move the middleware.ts to the root but got this error instead:
1[10:24:39.100] Running build in Washington, D.C., USA (East) – iad12[10:24:39.229] Cloning github.com/rizqyazed/personal-web-v2 (Branch: main, Commit: f18b604)3[10:24:39.765] Cloning completed: 540.000ms4[10:24:40.860] Restored build cache from previous deployment (J6bK3HwFczPnFbqoEkNasPZ5VNfX)5[10:24:40.937] Running "vercel build"6[10:24:41.319] Vercel CLI 41.2.27[10:24:42.057] Installing dependencies...8[10:24:44.155] 9[10:24:44.155] up to date in 2s10[10:24:44.156] 11[10:24:44.156] 171 packages are looking for funding12[10:24:44.156] run `npm fund` for details13[10:24:44.196] Running "npm run build"14[10:24:44.346] 15[10:24:44.346] > ideaideaidea@0.0.1 build16[10:24:44.347] > astro build17[10:24:44.347] 18[10:24:45.811] 10:24:45 [content] Syncing content19[10:24:45.814] 10:24:45 [content] Synced content20[10:24:45.815] 10:24:45 [types] Generated 44ms21[10:24:45.817] 10:24:45 [build] output: "server"22[10:24:45.817] 10:24:45 [build] mode: "server"23[10:24:45.817] 10:24:45 [build] directory: /vercel/path0/dist/24[10:24:45.817] 10:24:45 [build] adapter: @astrojs/vercel25[10:24:45.818] 10:24:45 [build] Collecting build info...26[10:24:45.818] 10:24:45 [build] ✓ Completed in 69ms.27[10:24:45.819] 10:24:45 [build] Building server entrypoints...28[10:24:48.087] 10:24:48 [vite] [32m✓ built in 2.22s[39m29[10:24:48.088] 10:24:48 [build] ✓ Completed in 2.27s.30[10:24:48.089] 31[10:24:48.089] building client (vite) 32[10:24:48.099] 10:24:48 [vite] transforming...33[10:24:48.131] 10:24:48 [vite] [32m✓[39m 3 modules transformed.34[10:24:48.141] 10:24:48 [vite] rendering chunks...35[10:24:48.147] 10:24:48 [vite] [32m✓ built in 52ms[39m36[10:24:48.175] 37[10:24:48.175] prerendering static routes 38[10:24:48.181] 10:24:48 ▶ src/pages/archive.astro39[10:24:48.798] 10:24:48 └─ /archive/index.html (+616ms) 40[10:24:48.801] 10:24:48 ▶ src/pages/index.astro41[10:24:48.803] 10:24:48 └─ /index.html (+2ms) 42[10:24:48.988] 10:24:48 ▶ src/pages/[slug].astro43[10:24:49.256] 10:24:49 └─ /testing/index.html (+3ms) 44[10:24:49.257] 10:24:49 ✓ Completed in 1.10s.45[10:24:49.257] 46[10:24:49.258] 10:24:49 [build] Rearranging server assets...47[10:24:49.270] 10:24:49 [@astrojs/vercel] Bundling function ../../../../dist/server/entry.mjs48[10:24:50.309] 10:24:50 [@astrojs/vercel] Copying static files to .vercel/output/static49[10:24:50.313] 10:24:50 [build] Server built in 4.57s50[10:24:50.315] 10:24:50 [build] Complete!51[10:24:50.596] Using TypeScript 5.7.3 (local user-provided)52[10:24:53.063] middleware.ts(1,8): error TS1286: ESM syntax is not allowed in a CommonJS module when 'verbatimModuleSyntax' is enabled.53[10:24:53.064] middleware.ts(2,10): error TS1286: ESM syntax is not allowed in a CommonJS module when 'verbatimModuleSyntax' is enabled.54[10:24:53.064] middleware.ts(6,1): error TS1287: A top-level 'export' modifier cannot be used on value declarations in a CommonJS module when 'verbatimModuleSyntax' is enabled.55[10:24:53.064] middleware.ts(8,29): error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'es2022', 'esnext', 'system', 'node16', or 'nodenext'.56[10:24:53.064] middleware.ts(9,36): error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'es2022', 'esnext', 'system', 'node16', or 'nodenext'.57[10:24:53.064] middleware.ts(9,70): error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'es2022', 'esnext', 'system', 'node16', or 'nodenext'.58[10:24:53.064] 59[10:24:53.284] Build Completed in /vercel/output [11s]60[10:24:53.439] Deploying outputs...61[10:24:54.961] Error: The Edge Function "middleware" is referencing unsupported modules:62[10:24:54.961] - __vc__ns__/0/middleware.js: astro:middleware63[10:24:55.085]
I'm guessing its because I'm using the astro middleware module. Does that mean I would have to change it?