|
1 | | -import { appendFileSync, existsSync, readdirSync, readFileSync, writeFileSync } from 'fs'; |
2 | | -import { dirname, join, resolve, posix } from 'path'; |
3 | | -import { fileURLToPath } from 'url'; |
| 1 | +import { appendFileSync, existsSync, readdirSync, readFileSync, writeFileSync } from 'node:fs'; |
| 2 | +import { dirname, join, resolve, posix } from 'node:path'; |
| 3 | +import { fileURLToPath } from 'node:url'; |
4 | 4 | import esbuild from 'esbuild'; |
5 | 5 | import toml from '@iarna/toml'; |
6 | 6 |
|
@@ -231,8 +231,9 @@ async function generate_lambda_functions({ builder, publish, split }) { |
231 | 231 | writeFileSync(`.netlify/functions-internal/${name}.mjs`, fn); |
232 | 232 | writeFileSync(`.netlify/functions-internal/${name}.json`, fn_config); |
233 | 233 |
|
234 | | - redirects.push(`${pattern} /.netlify/functions/${name} 200`); |
235 | | - redirects.push(`${pattern}/__data.json /.netlify/functions/${name} 200`); |
| 234 | + const redirect = `/.netlify/functions/${name} 200`; |
| 235 | + redirects.push(`${pattern} ${redirect}`); |
| 236 | + redirects.push(`${pattern === '/' ? '' : pattern}/__data.json ${redirect}`); |
236 | 237 | } |
237 | 238 | } else { |
238 | 239 | const manifest = builder.generateManifest({ |
|
0 commit comments