-
Notifications
You must be signed in to change notification settings - Fork 368
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: support npm modules + edge functions in monorepos #6130
Conversation
#logAddedFunction(func) { | ||
log(`${NETLIFYDEVLOG} ${chalk.green('Loaded')} edge function ${chalk.yellow(this.#getDisplayName(func.name))}`) | ||
} | ||
#logEvent(event, { buildError, functionName, warnings = [] }) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have centralised all log messages in this method, similar to what we're doing with the serverless functions registry.
} | ||
|
||
/** | ||
* @param {string} urlPath | ||
* @param {string} method | ||
*/ | ||
matchURLPath(urlPath, method) { | ||
const declarations = this.#bundler.mergeDeclarations( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of generating a manifest and routes on each request, we generate it every time we build the functions and then cache it in this.#manifest
and this.#routes
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Summary
To make npm modules work in edge functions when in a monorepo setup, we need to use the repository root (and not the package root) as the base directory where we look for modules.
Closes https://linear.app/netlify/issue/COM-114/npm-modules-in-edge-functions-not-working-in-monorepo-setups.