lucacasonato / esbuild_deno_loader

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

Read permission is always required even with the portable loader #128

Open reosablo opened 4 months ago

reosablo commented 4 months ago

The docs state that the portable loader requires --allow-read and/or --allow-net, but the former is always required in fact.

This seems to be because of the Deno.cwd() call.

https://github.com/lucacasonato/esbuild_deno_loader/blob/ccd8992c690deee821d6b7a7efeaf599722c394c/src/plugin_deno_loader.ts#L187-L190

The workaround for this issue is to specify a dummy absWorkingDir value in the esbuild configuration.

const result = await esbuild.build({
  // ...
  // required to avoid read permission of CWD by esbuild_deno_loader
  absWorkingDir: "/",
});

I encountered this problem when using this plugin in Val Town, which does not allow read permissions.