Skip to content

Commit

Permalink
fix: mute esbuild while parsing for NPM modules (#497)
Browse files Browse the repository at this point in the history
* fix: mute esbuild while parsing for NPM modules

* fix: update error message
  • Loading branch information
Skn0tt committed Oct 11, 2023
1 parent 8278713 commit 6a3685e
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions node/npm_dependencies.ts
Original file line number Diff line number Diff line change
Expand Up @@ -142,22 +142,28 @@ export const vendorNPMSpecifiers = async ({
// loaded as npm dependencies, because they either use the `npm:` prefix or
// they are bare specifiers. We'll collect them in `specifiers`.
try {
await build({
const { errors, warnings } = await build({
banner,
bundle: true,
entryPoints: functions,
logLevel: 'error',
logLevel: 'silent',
nodePaths,
outdir: temporaryDirectory.path,
platform: 'node',
plugins: [getDependencyTrackerPlugin(specifiers, importMap.getContentsWithURLObjects(), pathToFileURL(basePath))],
write: false,
format: 'esm',
})
if (errors.length !== 0) {
logger.system('ESBuild errored while tracking dependencies in edge function:', errors)
}
if (warnings.length !== 0) {
logger.system('ESBuild warned while tracking dependencies in edge function:', warnings)
}
} catch (error) {
logger.system('Could not track dependencies in edge function:', error)
logger.user(
'An error occurred when trying to scan your edge functions for npm modules, which is an experimental feature. If you are loading npm modules, please share the errors above in https://ntl.fyi/edge-functions-npm. If you are not loading npm modules, you can ignore this message.',
'An error occurred when trying to scan your edge functions for npm modules, which is an experimental feature. If you are loading npm modules, please share the link to this deploy in https://ntl.fyi/edge-functions-npm. If you are not loading npm modules, you can ignore this message.',
)
}

Expand Down

0 comments on commit 6a3685e

Please sign in to comment.