fix(api-route): Fix bug of build platform and format
MODIFY
packages/preset-umi/src/features/apiRoute/dev-server/esbuild.ts
packages/preset-umi/src/features/apiRoute/dev-server/esbuild.ts
@@ -12,6 +12,7 @@ export default async function (api: IApi, apiRoutes: IRoute[]) {
await esbuild.build({
format: 'cjs',
+ platform: 'node',
bundle: true,
entryPoints: [
...apiRoutePaths,

MODIFY
packages/preset-umi/src/features/apiRoute/vercel/esbuild.ts
packages/preset-umi/src/features/apiRoute/vercel/esbuild.ts
@@ -18,8 +18,8 @@ export default async function (api: IApi, apiRoutes: IRoute[]) {
);
await esbuild.build({
- format: 'esm',
- outExtension: { '.js': '.mjs' },
+ format: 'cjs',
+ platform: 'node',
bundle: true,
entryPoints: [
...apiRoutePaths,

fix(api-route): Fix bug of build platform and format (#465)