bpevB
Deno3y ago
3 replies
bpev

How does Fresh run esbuild on Deploy without cache writes?

I'm trying to build some solidjs code during runtime, but I keep getting errors on Deploy because of writes to esbuild cache:

[uncaught application error]: PermissionDenied - Requires write access to '/src/.cache/esbuild/bin', but the file system on Deno Deploy is read-only.


My config looks pretty similar I think?
  const [denoResolver, denoLoader] = [...denoPlugins({
    portable: true,
    configPath: resolve('./deno.json'),
  })]

  const results = await esbuild.build({
    plugins: [
      denoResolver,
      solidPlugin({ solid: { moduleName: 'npm:solid-js/web' } }),
      denoLoader
    ],
    entryPoints: ['./www/index.tsx'],
    outfile: '.',
    bundle: true,
    platform: 'browser',
    format: 'esm',
    target: ['chrome99', 'safari15'],
    treeShaking: true,
    write: false,
  })


fresh esbuild config: https://github.com/denoland/fresh/blob/2fc212cc045e4f71a787a5bc9ebdee1ef5770bf9/src/build/esbuild.ts#L96

edit: oh is it writes from installing via npm?? Maybe portable isn't as portable as I thought.
at Object.mkdir (ext:deno_fs/30_fs.js:140:14)
    at installFromNPM (https://deno.land/x/esbuild@v0.19.4/mod.js:1782:14)
    at eventLoopTick (ext:core/01_core.js:183:11)
    at async install (https://deno.land/x/esbuild@v0.19.4/mod.js:1867:12)
    at async https://deno.land/x/esbuild@v0.19.4/mod.js:1878:23
    at async Module.initialize (https://deno.land/x/esbuild@v0.19.4/mod.js:1768:3)
GitHub
The next-gen web framework. Contribute to denoland/fresh development by creating an account on GitHub.
Was this page helpful?