Skip to content

satori no longer runs in browser #738

Description

@altano

Bug report

Description / Observed Behavior

Satori used to run just fine in a browser, no modification needed. The yoga code added a check for process.env.SATORI_STANDALONE. Since process doesn't exist in the browser, this line causes a ReferenceError.

Expected Behavior

satori.js can be used in a browser without modification

Reproduction

This is satori v0.16.2: it works perfectly and the text "Hello" will pop up:
https://stackblitz.com/edit/vitejs-vite-ewkfehfb?file=package.json&terminal=dev

This is the same exact code but v0.18.0: it will fail to load the text and you'll see the console error Uncaught (in promise) ReferenceError: process is not defined:
https://stackblitz.com/edit/vitejs-vite-r5zp4m4r?file=package.json&terminal=dev

Additional Context

It looks like v18 broke this behavior and it's still broken in v0.26.0. People probably didn't notice because process is so often shimmed. The satori playground uses Next which, for example, takes care of it for you. But a default Vite project doesn't shim process for you and it breaks there.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions