mirror of
https://github.com/LukeHagar/vercel.git
synced 2025-12-07 21:07:46 +00:00
[node] Add streaming support for vc dev (#9745)
Until now, the user code response it's buffered and serialized. This is mismatching how Vercel works these days. This PR enables streaming response in `vc dev` for Edge/Serverless. As part of the implementation, the `node-bridge` which spawns a process to consume the user code is not necessary anymore. Some necessary files (like HTTP server helpers) have been moved to live in node builder package instead. --------- Co-authored-by: Ethan Arrowood <ethan.arrowood@vercel.com> Co-authored-by: Sean Massa <EndangeredMassa@gmail.com>
This commit is contained in:
13
packages/node/src/serverless-functions/dynamic-import.js
Normal file
13
packages/node/src/serverless-functions/dynamic-import.js
Normal file
@@ -0,0 +1,13 @@
|
||||
'use strict';
|
||||
|
||||
const { pathToFileURL } = require('url');
|
||||
const { isAbsolute } = require('path');
|
||||
|
||||
function dynamicImport(filepath) {
|
||||
const id = isAbsolute(filepath) ? pathToFileURL(filepath).href : filepath;
|
||||
return import(id);
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
dynamicImport,
|
||||
};
|
||||
Reference in New Issue
Block a user