Open amoshydra opened 2 months ago
What:
Fix #233. Allow NodeJS original node_module algorithm to be used by @esbuild-plugins/node-resolve / resolve.
node_module
@esbuild-plugins/node-resolve
resolve
Why:
cwd
node_modules
Below illustrate the incorrect search paths when basedir is mapped to cwd
basedir
cwd: - "/project" import: - "package-a" caller: - "/project/node_modules/package-c" search_paths: - "/project/node_modules/package-a" - "/node_modules/package-a"
How:
By removing resolveOptions.basedir, it allow @esbuild-plugins/node-resolve / resolve to use the default NodeJS node_modules resolve algorithm where node_modules resolution starts from the directory of the caller module.
resolveOptions.basedir
Below illustrate the correct search paths
cwd: - "/project" import: - "package-a" caller: - "/project/node_modules/package-c" search_paths: - "/project/node_modules/package-c/node_modules/package-a" - "/project/node_modules/package-a" - "/node_modules/package-a"
Checklist:
What:
Fix #233. Allow NodeJS original
node_module
algorithm to be used by@esbuild-plugins/node-resolve
/resolve
.Why:
68 specified basedir to
cwd
which causes allnode_modules
resolution to start atcwd
. This prevent nestednode_modules
to ever be resolved. See #233Below illustrate the incorrect search paths when
basedir
is mapped tocwd
How:
By removing
resolveOptions.basedir
, it allow@esbuild-plugins/node-resolve
/resolve
to use the default NodeJSnode_modules
resolve algorithm wherenode_modules
resolution starts from the directory of the caller module.Below illustrate the correct search paths
Checklist: