lucacasonato / esbuild_deno_loader

Deno module resolution for `esbuild`
https://deno.land/x/esbuild_deno_loader
MIT License
156 stars 41 forks source link

[ERROR] File name too long #103

Open TomokiMiyauci opened 6 months ago

TomokiMiyauci commented 6 months ago

When attempting to build a package with many dependencies, the following error occurs:

error: Uncaught (in promise) Error: Build failed with 1 error:
error: File name too long (os error 63): mkdir ~
...

Reproduction:

import * as esbuild from "https://deno.land/x/esbuild@v0.19.11/mod.js";
import { denoPlugins } from "https://deno.land/x/esbuild_deno_loader@0.8.3/mod.ts";

const result = await esbuild.build({
  plugins: [
    ...denoPlugins(),
  ],
  entryPoints: ["npm:sanity@3.25.0"],
  outfile: "./dist/bytes.esm.js",
  bundle: true,
  format: "esm",
});

console.log(result.outputFiles);

esbuild.stop();

This seems to be caused by the npmPackageId exceeding the OS limit.

How about using a hash value instead?

nestarz commented 5 months ago

I also have an issue with long directories for ex (npm:@uiw/react-codemirror):

error: Uncaught (in promise) Error: Build failed with 1 error:
module/src/components/CodeEditor.tsx:2:23: ERROR: [plugin: deno-loader] File name too long (os error 63): mkdir '/Users/dov/Library/Caches/deno/deno_esbuild/@uiw/react-codemirror@4.21.21_@babel+runtime@7.23.9_@codemirror+state@6.4.0_@codemirror+theme-one-dark@6.1.2_@codemirror+view@6.24.0_codemirror@6.0.1__@codemirror+language@6.10.1__@codemirror+state@6.4.0__@codemirror+view@6.24.0_react@18.2.0_react-dom@18.2.0__react@18.2.0_@codemirror+commands@6.3.3/node_modules/@uiw'
  let error = new Error(text);
              ^
    at failureErrorWithLog (https://deno.land/x/esbuild@v0.20.0/mod.js:1626:15)
chrisdevereux commented 5 months ago

As a workaround, enabling nodeModulesDir option resolves this for me