diff --git a/packages/next-swc/crates/next-api/src/server_actions.rs b/packages/next-swc/crates/next-api/src/server_actions.rs index 9afe9d0f544e7..c51234ad11eed 100644 --- a/packages/next-swc/crates/next-api/src/server_actions.rs +++ b/packages/next-swc/crates/next-api/src/server_actions.rs @@ -95,17 +95,14 @@ async fn build_server_actions_loader( for (hash_id, name) in &*actions_map.await? { writedoc!( contents, - " - \x20 '{hash_id}': (...args) => import('{module_name}') - .then(mod => (0, mod['{name}'])(...args)),\n - ", + " '{hash_id}': (...args) => (0, require('{module_name}')['{name}'])(...args),", )?; } import_map.insert(module_name, module.1); } write!(contents, "}});")?; - let output_path = node_root.join(format!("server/app{page_name}/actions.ts")); + let output_path = node_root.join(format!("server/app{page_name}/actions.js")); let file = File::from(contents.build()); let source = VirtualSource::new(output_path, AssetContent::file(file.into())); let module = asset_context.process( diff --git a/test/turbopack-tests-manifest.json b/test/turbopack-tests-manifest.json index 7f65a984e578f..3acff1e757203 100644 --- a/test/turbopack-tests-manifest.json +++ b/test/turbopack-tests-manifest.json @@ -2192,7 +2192,12 @@ }, "test/e2e/app-dir/actions/app-action.test.ts": { "passed": [ + "app-dir action handling Edge SSR should allow cookie and header async storages", + "app-dir action handling Edge SSR should handle basic actions correctly", "app-dir action handling Edge SSR should handle redirect to a relative URL in a single pass", + "app-dir action handling Edge SSR should handle regular redirects", + "app-dir action handling Edge SSR should handle unicode search params", + "app-dir action handling Edge SSR should return error response for hoc auth wrappers in edge runtime", "app-dir action handling HMR should support updating the action", "app-dir action handling encryption should send encrypted values from the closed over closure", "app-dir action handling fetch actions should handle a fetch action initiated from a static page", @@ -2224,13 +2229,8 @@ "app-dir action handling should support uploading files" ], "failed": [ - "app-dir action handling Edge SSR should allow cookie and header async storages", - "app-dir action handling Edge SSR should handle basic actions correctly", - "app-dir action handling Edge SSR should handle regular redirects", - "app-dir action handling Edge SSR should handle unicode search params", - "app-dir action handling Edge SSR should return error response for hoc auth wrappers in edge runtime", - "app-dir action handling should bundle external libraries if they are on the action layer", - "app-dir action handling should support importing the same action module instance in both server and action layers" + "app-dir action handling should support importing the same action module instance in both server and action layers", + "app-dir action handling should bundle external libraries if they are on the action layer" ], "pending": [ "app-dir action handling fetch actions should handle revalidateTag + redirect"