We recently introduced module aliasing in #6167
The experimental:nodejs_compat_v2 flag introduces unenv polyfills via an esbuild plugin onResolve hook. This plugin takes precedence over the user-defined aliases.
A simple repro can be found here https://github.com/RamIdeas/esbuild-alias-wrangler-repro/blob/main/build.mjs
I believe the solution is to reimplement the user-defined aliases via our own plugin which needs to be earlier in the plugin array. Creating this issue to track.
We recently introduced module aliasing in #6167
The
experimental:nodejs_compat_v2flag introduces unenv polyfills via an esbuild plugin onResolve hook. This plugin takes precedence over the user-defined aliases.A simple repro can be found here https://github.com/RamIdeas/esbuild-alias-wrangler-repro/blob/main/build.mjs
I believe the solution is to reimplement the user-defined aliases via our own plugin which needs to be earlier in the plugin array. Creating this issue to track.