diff --git a/src/lib/functions/netlify-function.ts b/src/lib/functions/netlify-function.ts index 8acd316709c..f4f55501771 100644 --- a/src/lib/functions/netlify-function.ts +++ b/src/lib/functions/netlify-function.ts @@ -121,7 +121,7 @@ export default class NetlifyFunction { } if (extension === '.js') { - return '.js' + return '.mjs' } } diff --git a/src/lib/functions/runtimes/js/builders/zisi.ts b/src/lib/functions/runtimes/js/builders/zisi.ts index e85de6f0429..1d08ab35112 100644 --- a/src/lib/functions/runtimes/js/builders/zisi.ts +++ b/src/lib/functions/runtimes/js/builders/zisi.ts @@ -175,7 +175,7 @@ export default async function handler({ config, directory, errorExit, func, meta featureFlags.zisi_pure_esm_mjs = true } else { // We must use esbuild for certain file extensions. - const mustTranspile = ['.js', '.ts', '.mts', '.cts'].includes(path.extname(func.mainFile)) + const mustTranspile = ['.mjs', '.ts', '.mts', '.cts'].includes(path.extname(func.mainFile)) const mustUseEsbuild = hasTypeModule || mustTranspile if (mustUseEsbuild && !functionsConfig['*'].nodeBundler) {