Skip to content

I'm seeing an issue when fdir@6.5.0 is bundled using esbuild. #163

@Jason3S

Description

@Jason3S

I'm seeing an issue when fdir@6.5.0 is bundled using esbuild.

Generated code:

// ../../../../node_modules/.pnpm/fdir@6.5.0_picomatch@4.0.3/node_modules/fdir/dist/index.mjs
var import_module = require("module");
var import_path2 = require("path");
var nativeFs = __toESM(require("fs"), 1);
var import_meta2 = {};
var __require = /* @__PURE__ */ (0, import_module.createRequire)(import_meta2.url);
function cleanPath(path14) {
  let normalized = (0, import_path2.normalize)(path14);
  if (normalized.length > 1 && normalized[normalized.length - 1] === import_path2.sep) normalized = normalized.substring(0, normalized.length - 1);
  return normalized;
}

error:

node:internal/modules/cjs/loader:1895
    throw new ERR_INVALID_ARG_VALUE('filename', filename, createRequireError);
          ^

TypeError [ERR_INVALID_ARG_VALUE]: The argument 'filename' must be a file URL object, file URL string, or absolute path string. Received undefined
    at createRequire (node:internal/modules/cjs/loader:1895:11)
    at Object.<anonymous> (/Users/jason/projects/cspell/test-packages/cspell/test-cspell-esbuild-cjs/bin/dist/index.cjs:42093:65)
    at Module._compile (node:internal/modules/cjs/loader:1692:14)
    at Object..js (node:internal/modules/cjs/loader:1824:10)
    at Module.load (node:internal/modules/cjs/loader:1427:32)
    at Module._load (node:internal/modules/cjs/loader:1250:12)
    at TracingChannel.traceSync (node:diagnostics_channel:322:14)
    at wrapModuleLoad (node:internal/modules/cjs/loader:235:24)
    at Module.require (node:internal/modules/cjs/loader:1449:12)
    at require (node:internal/modules/helpers:135:16) {
  code: 'ERR_INVALID_ARG_VALUE'
}

Originally posted by @Jason3S in #147 (comment)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions