-
-
Notifications
You must be signed in to change notification settings - Fork 1
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
Does not resolve to files in node_modules lower than root #2
Comments
The similar issue, it is not that it can't resolve files lower than the root folder, but it can't resolve the files that are not the entry files and are not under the root folder. But it works if we call the Test code: const resolveFile = require('resolve-file')
console.log(resolveFile('esbuild-plugin-postcss2/LICENSE'))
// output: /repo_path/node_modules/esbuild-plugin-postcss2/LICENSE
console.log(resolveFile('esbuild-plugin-postcss2/dist/index.js'))
// output: /repo_path/node_modules/esbuild-plugin-postcss2/dist/index.js
console.log(resolveFile('esbuild-plugin-postcss2/dist/index.esm.js'))
// output: /repo_path/node_modules/esbuild-plugin-postcss2/dist/index.esm.js
console.log(resolveFile('esbuild-plugin-postcss2/src/modules.d.ts'))
// output: null
// directly use require.resolve
console.log(require.resolve('esbuild-plugin-postcss2/src/modules.d.ts'))
// output: /repo_path/node_modules/esbuild-plugin-postcss2/src/modules.d.ts I don't understand the below code logic very much: Lines 98 to 106 in f598211
if (!utils.exists(file.path)) {
try {
if (/[\\\/]/.test(name)) {
file.basename = path.basename(name);
var dirname = path.dirname(name);
file.name = path.basename(dirname);
file.main = require.resolve(dirname);
file.path = path.resolve(path.dirname(file.main), file.basename);
} Why do we call |
Steps to reproduce:
Root file works fine:
Lower file does not:
The text was updated successfully, but these errors were encountered: