Skip to content

CJS dependencies cause fatal issues when building/running that go unnoticed in dev mode #3653

@CAYdenberg

Description

@CAYdenberg

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions