[cli] Fix vc dev with dynamic paths and ESM (#7946)

In a previous PR, the entrypoint path extension was stripped in `vc dev` to match the behavior of production deployments (`/api/user.js` => `/api/user`). However, it was supposed to map back to the original file extension before invoking the matching builder. This PR fixes the mapping for dynamic paths with ESM, such as `/api/[id].mjs` => `/api/[id]`.
This commit is contained in:
Steven
2022-06-12 13:54:21 -04:00
committed by GitHub
parent 2c15e496ed
commit 5205a4ec4b
4 changed files with 27 additions and 4 deletions

View File

@@ -315,6 +315,14 @@ test(
})
);
test(
'[vercel dev] 42-dynamic-esm-ext',
testFixtureStdio('42-dynamic-esm-ext', async (testPath: any) => {
await testPath(200, '/api/cjs/foo', 'found .js');
await testPath(200, '/api/esm/foo', 'found .mjs');
})
);
test(
'[vercel dev] Use `@vercel/python` with Flask requirements.txt',
testFixtureStdio('python-flask', async (testPath: any) => {