File tree Expand file tree Collapse file tree 2 files changed +7
-21
lines changed
packages/vite-plugin-cloudflare/src/plugins Expand file tree Collapse file tree 2 files changed +7
-21
lines changed Load Diff This file was deleted.
Original file line number Diff line number Diff line change @@ -403,24 +403,15 @@ export class NodeJsCompat {
403403 ) : { unresolved : string ; resolved : string } | undefined {
404404 const alias = this . #env. alias [ source ] ;
405405
406+ // These aliases must be resolved from the context of this plugin since the alias will refer to one of the
407+ // `@cloudflare/unenv-preset` or the `unenv` packages, which are direct dependencies of this package,
408+ // and not the user's project.
406409 // We exclude `externals` as these should be externalized rather than optimized.
407410 if ( alias && ! this . externals . has ( alias ) ) {
408- try {
409- // These aliases must be resolved from the context of this plugin since the alias can refer to one of
410- // the `@cloudflare/unenv-preset` or the `unenv` packages, which are direct dependencies of this package,
411- // and not the user's project.
412- // When the alias is a package (i.e. the `debug` npm package), `resolvePathSync` will throw
413- return {
414- unresolved : alias ,
415- resolved : resolvePathSync ( alias , { url : import . meta. url } ) ,
416- } ;
417- } catch {
418- // Returns the raw alias when it can not be resolved.
419- return {
420- unresolved : source ,
421- resolved : alias ,
422- } ;
423- }
411+ return {
412+ unresolved : alias ,
413+ resolved : resolvePathSync ( alias , { url : import . meta. url } ) ,
414+ } ;
424415 }
425416
426417 if ( this . entries . has ( source ) ) {
You can’t perform that action at this time.
0 commit comments