Reproduction is here: https://github.com/CAYdenberg/fresh-2-cjs-build-repro
- deno task dev - works
- deno task build then deno task start - does not work, results in
error: Uncaught (in promise) ReferenceError: Cannot access '_default$i' before initialization
const Range$2 = __require$g ?? _default$i ?? _mod$2;
Also, resetting to the initial commit or commenting out the use of Sharp will result in a successful build.
The issue probably stems from Sharp being written in CJS. Still, it would be awesome if deno install or Fresh or the Fresh vite plugin could issue a warning when encountering CJS, as it is very difficult to debug when a project is working fine in development mode and then fails at the very last step.
Reproduction is here: https://github.com/CAYdenberg/fresh-2-cjs-build-repro
Also, resetting to the initial commit or commenting out the use of Sharp will result in a successful build.
The issue probably stems from Sharp being written in CJS. Still, it would be awesome if deno install or Fresh or the Fresh vite plugin could issue a warning when encountering CJS, as it is very difficult to debug when a project is working fine in development mode and then fails at the very last step.