-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
import/no-cycle
no such file or directory, stat 'path'
#2418
Comments
(I'm not sure what Are you perhaps importing a file that doesn't exist, and that's what's causing this crash? What's the contents of |
I dont think im able to share the contents of the project unfortunately, but its just exporting things from other local modules, e.g.: export { foo } from './src/bar.js';
// etc I can confirm all the files that its reexporting exist |
Right, figured out the issue. I'm using the custom resolver that was posted here, because package export maps were not being respected correctly. Using that resolver correctly resolved my issues, until it tried to resolve node built-in modules. I've updated the custom resolver to the following: const path = require('path');
const { resolve: resolveExports } = require('resolve.exports');
+const { builtinModules } = require('module');
/**
* @param {string} source source
* @param {string} file file
* @param {Object} _config config
*/
const resolve = (source, file, _config) => {
try {
const moduleId = require.resolve(source, { paths: [path.dirname(file)] });
+ if (builtinModules.includes(moduleId)) {
+ return { found: false };
+ }
return { found: true, path: moduleId };
} catch (/** @type {any} */ err) {
if (err.code === 'MODULE_NOT_FOUND' && err.path?.endsWith('/package.json')) {
const { name, module, main, exports } = require(err.path);
const resolved = resolveExports({ name, module, main, exports }, source);
const moduleId = path.join(path.dirname(err.path), resolved);
return { found: true, path: moduleId };
}
return { found: false };
}
};
module.exports = {
interfaceVersion: 2,
resolve,
}; And that resolved the issue. I've also posted this fix on the gist in case anybody else runs into the same issue. |
Using the latest version of
[email protected]
together with[email protected]
results in:The text was updated successfully, but these errors were encountered: